Create order for automatic authorization
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:
- Review order response: PayPal returns order ID with
PAYER_ACTION_REQUIREDstatus andpayer-actionlink - Redirect your buyer: Send the buyer to the
payer-actionURL to complete payment on Klarna's platform - Monitor payment status: Buyer approves payment and order status automatically changes to
COMPLETED - Capture the payment: Send POST request to
/v2/payments/authorizations/{authorization_id}/capturewith the authorization ID from the order details - Notify the buyer: Send order confirmation to the buyer
- Sample request
- 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": 3049 },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:
- Review order response: PayPal returns order ID with
CREATEDstatus andapprovelink - Add payment source details: Choose one of two options:
- Send POST request to
/v2/checkout/orders/{order_id}/confirm-payment-sourcewith completepayment_source.klarnaobject - Include payment source details in the authorization call
- Send POST request to
- Redirect your buyer: Send the buyer to the
approveURL to complete payment approval - Monitor payment status: Buyer approves payment and authorization occurs automatically
- Capture the payment: Send POST request to
/v2/payments/authorizations/{authorization_id}/capturewith the authorization ID from the order details - Notify the buyer: Send order confirmation to the buyer
- Sample request
- 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": 3020 },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 |
|---|---|
intentRequired, string |
Indicates whether payment is captured immediately or authorized for later capture.
For Klarna payments, set to |
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_unitsRequired, array |
Lists the items or services the buyer is purchasing in the order. |
purchase_units.amountRequired, object |
Amount of the order and the currency code. For supported currencies, see Supported countries and currencies. |
payment_sourceobject |
Payment method used to fund the order. For Klarna payments, include a klarna object with buyer and experience context information. |
payment_source.klarna.authorization_contextobject |
Payment authorization settings with expiration time. |
payment_source.klarna.authorization_context.expiration_timestring |
Timestamp of when the authorization expires, specified in UTC format. |
payment_source.klarna.country_codeRequired, object |
Country where the buyer is located. Use 2-character ISO 3166-1 alpha-2 country code. |
payment_source.klarna.name.given_nameRequired, object |
Buyer's first name. |
payment_source.klarna.name.surnameRequired, object |
Buyer's last name. |
payment_source.klarna.billing_addressRequired, object |
Buyer's billing address information including address lines, city, state, postal code, and country. |
payment_source.klarna.experience_contextRequired, object |
Context information for the Klarna payment experience including locale, intent, and acquiring channel. |
payment_source.klarna.experience_context.localeRequired, object |
Locale for the Klarna payment experience. For example, en-GB, en-US. |
application_contextobject |
Application context for the order. Customizes the buyer experience during the approval process. |
application_context.return_urlstring |
URL to redirect the buyer after they approve the payment. |
application_context.cancel_urlstring |
URL to redirect the buyer if they cancel the approval. |