Create order for automatic authorization

DocsLimited

Last updated: Nov 6th, 9:17pm

Automatic authorization occurs immediately after buyer approval, streamlining the payment process. Create orders for automatic authorization using two available flows.

  • Single-step flow: Include payment source details directly in the create order request for a streamlined integration
  • Multi-step flow: Create the order first, then add payment source details in a separate step for more flexibility

Single-step flow

Use a valid access token and send a POST request /v2/checkout/orders with request body parameters including intent, purchase_units with amount and currency, payment_source with Klarna details, and processing_instruction set to ORDER_COMPLETE_ON_PAYMENT_APPROVAL.

On successful order creation, complete the Klarna payment with these steps:

  1. Review order response: PayPal returns order ID with PAYER_ACTION_REQUIRED status and payer-action link
  2. Redirect your buyer: Send the buyer to the payer-action URL to complete payment on Klarna's platform
  3. Monitor payment status: Buyer approves payment and order status automatically changes to COMPLETED
  4. Capture the payment: Send POST request to /v2/payments/authorizations/{authorization_id}/capture with the authorization ID from the order details
  5. Notify the buyer: Send order confirmation to the buyer
  1. Sample request
  2. Sample response
1curl -X POST https://api.sandbox.paypal.com/v2/checkout/orders \
2 -H 'Content-Type: application/json' \
3 -H 'Authorization: Bearer <ACCESS-TOKEN>' \
4 -d '{
5 "intent": "AUTHORIZE",
6 "processing_instruction": "ORDER_COMPLETE_ON_PAYMENT_APPROVAL",
7 "payment_source": {
8 "klarna": {
9 "authorization_context": {
10 "authorization_expiry": "2025-10-18T23:37:39Z"
11 },
12 "country_code": "GB",
13 "billing_address": {
14 "address_line_1": "10 New Burlington Street",
15 "admin_area_2": "London",
16 "admin_area_1": "Greater London",
17 "postal_code": "W1S 3BE",
18 "country_code": "GB"
19 },
20 "name": {
21 "given_name": "John",
22 "surname": "Doe"
23 },
24 "email_address": "customer@email.uk",
25 "phone": {
26 "national_number": "7755564318",
27 "country_code": "44"
28 },
29 "experience_context": {
30 "locale": "en-GB",
31 "acquiring_channel": "ECOMMERCE",
32 "return_url": "https://www.example.com/returnUrl",
33 "cancel_url": "https://www.example.com/cancelUrl"
34 }
35 }
36 },
37 "purchase_units": [
38 {
39 "payee": {
40 "merchant_id": "YR8FPJ7TDVD6A"
41 },
42 "amount": {
43 "currency_code": "GBP",
44 "value": 30,
45 "breakdown": {
46 "item_total": {
47 "currency_code": "GBP",
48 "value": 30
49 },
50 "shipping": {
51 "currency_code": "GBP",
52 "value": "0.00"
53 },
54 "handling": {
55 "currency_code": "GBP",
56 "value": "0.00"
57 },
58 "tax_total": {
59 "currency_code": "GBP",
60 "value": "0.00"
61 },
62 "shipping_discount": {
63 "currency_code": "GBP",
64 "value": "0.00"
65 }
66 }
67 },
68 "items": [
69 {
70 "name": "jersey",
71 "description": "jersey",
72 "sku": "",
73 "unit_amount": {
74 "currency_code": "GBP",
75 "value": "15.00"
76 },
77 "tax": {
78 "currency_code": "GBP",
79 "value": "0.00"
80 },
81 "category": "PHYSICAL_GOODS",
82 "quantity": "1"
83 },
84 {
85 "name": "jersey",
86 "description": "jersey",
87 "sku": "",
88 "unit_amount": {
89 "currency_code": "GBP",
90 "value": "15.00"
91 },
92 "tax": {
93 "currency_code": "GBP",
94 "value": "0.00"
95 },
96 "category": "PHYSICAL_GOODS",
97 "quantity": "1"
98 }
99 ]
100 }
101 ],
102 "application_context": {
103 "client_configuration": {
104 "api": "ORDERS_V2",
105 "experience": {
106 "entry_point": "PAY_WITH_ALTPAY_KLARNA",
107 "payment_method": "PAY_WITH_ALTPAY_KLARNA"
108 }
109 }
110 }
111}'

Multi-step flow

Use a valid access token and send a POST request to /v2/checkout/orders with request body parameters including intent, purchase_units with amount and currency, and processing_instruction set to ORDER_COMPLETE_ON_PAYMENT_APPROVAL.

On successful order creation, complete the Klarna payment with these steps:

  1. Review order response: PayPal returns order ID with CREATED status and approve link
  2. Add payment source details: Choose one of two options:
    • Send POST request to /v2/checkout/orders/{order_id}/confirm-payment-source with complete payment_source.klarna object
    • Include payment source details in the authorization call
  3. Redirect your buyer: Send the buyer to the approve URL to complete payment approval
  4. Monitor payment status: Buyer approves payment and authorization occurs automatically
  5. Capture the payment: Send POST request to /v2/payments/authorizations/{authorization_id}/capture with the authorization ID from the order details
  6. Notify the buyer: Send order confirmation to the buyer
  1. Sample request
  2. Sample response
1curl -X POST https://api.sandbox.paypal.com/v2/checkout/orders \
2 -H 'Content-Type: application/json' \
3 -H 'Authorization: Bearer <ACCESS-TOKEN>' \
4 -H 'PayPal-Request-Id: <REQUEST-ID>' \
5 -d '{
6 "intent": "AUTHORIZE",
7 "processing_instruction": "ORDER_COMPLETE_ON_PAYMENT_APPROVAL",
8 "purchase_units": [
9 {
10 "payee": {
11 "merchant_id": "YR8FPJ7TDVD6A"
12 },
13 "amount": {
14 "currency_code": "GBP",
15 "value": 30,
16 "breakdown": {
17 "item_total": {
18 "currency_code": "GBP",
19 "value": 30
20 },
21 "shipping": {
22 "currency_code": "GBP",
23 "value": "0.00"
24 },
25 "handling": {
26 "currency_code": "GBP",
27 "value": "0.00"
28 },
29 "tax_total": {
30 "currency_code": "GBP",
31 "value": "0.00"
32 },
33 "shipping_discount": {
34 "currency_code": "GBP",
35 "value": "0.00"
36 }
37 }
38 },
39 "items": [
40 {
41 "name": "jersey",
42 "description": "jersey",
43 "sku": "",
44 "unit_amount": {
45 "currency_code": "GBP",
46 "value": "15.00"
47 },
48 "tax": {
49 "currency_code": "GBP",
50 "value": "0.00"
51 },
52 "category": "PHYSICAL_GOODS",
53 "quantity": "1"
54 },
55 {
56 "name": "jersey",
57 "description": "jersey",
58 "sku": "",
59 "unit_amount": {
60 "currency_code": "GBP",
61 "value": "15.00"
62 },
63 "tax": {
64 "currency_code": "GBP",
65 "value": "0.00"
66 },
67 "category": "PHYSICAL_GOODS",
68 "quantity": "1"
69 }
70 ]
71 }
72 ],
73 "application_context": {
74 "client_configuration": {
75 "api": "ORDERS_V2",
76 "experience": {
77 "entry_point": "PAY_WITH_ALTPAY_KLARNA",
78 "payment_method": "PAY_WITH_ALTPAY_KLARNA"
79 }
80 }
81 }
82 }'
Parameter name Description
intent
Required, string
Indicates whether payment is captured immediately or authorized for later capture.

For Klarna payments, set to AUTHORIZE.

processing_instruction
string
Specifies how the order is processed.

For automatic authorization flow, exclude this parameter or set to ORDER_COMPLETE_ON_PAYMENT_APPROVAL.
purchase_units
Required, array
Lists the items or services the buyer is purchasing in the order.
purchase_units.amount
Required, object
Amount of the order and the currency code.

For supported currencies, see Supported countries and currencies.

payment_source
object
Payment method used to fund the order. For Klarna payments, include a klarna object with buyer and experience context information.
payment_source.klarna.authorization_context
object
Payment authorization settings with expiration time.
payment_source.klarna.authorization_context.expiration_time
string
Timestamp of when the authorization expires, specified in UTC format.
payment_source.klarna.country_code
Required, object
Country where the buyer is located. Use 2-character ISO 3166-1 alpha-2 country code.
payment_source.klarna.name.given_name
Required, object
Buyer's first name.
payment_source.klarna.name.surname
Required, object
Buyer's last name.
payment_source.klarna.billing_address
Required, object
Buyer's billing address information including address lines, city, state, postal code, and country.
payment_source.klarna.experience_context
Required, object
Context information for the Klarna payment experience including locale, intent, and acquiring channel.
payment_source.klarna.experience_context.locale
Required, object
Locale for the Klarna payment experience. For example, en-GB, en-US.
application_context
object
Application context for the order. Customizes the buyer experience during the approval process.

application_context.return_url
string
URL to redirect the buyer after they approve the payment.

application_context.cancel_url
string
URL to redirect the buyer if they cancel the approval.