Set up
Last updated: Oct 8th, 9:33pm
You can use the steps in this section to ensure that your accounts and environment are set up to accept Afterpay payments.
Prerequisite
A PayPal business account with Expanded Checkout enabled. You'll set up your environment first, then enable Afterpay with KYC verification completed.
Set up sandbox account
- Sign up for a PayPal developer account. On successful signup, PayPal automatically creates your sandbox environment. The sandbox environment mimics real-world transactions and includes a business account by default. You can create additional business accounts as needed.
- Set up the sandbox environment:
- Go to your PayPal developer account sandbox and toggle to Sandbox.
- Go to Apps & Credentials and select Create App.
- Enter your app name, set the Type to Merchant, choose the sandbox business account, and select Create App. The app details page will be displayed.
- Configure a webhook listener for the app and subscribe to events:
- In the app details page, go to Sandbox Webhooks.
- Select Add Webhook.
- Enter a Webhook URL (your server endpoint for PayPal notifications), select the events to subscribe to, and select Save.
The webhook listener is now configured, and a Webhook ID is displayed. Store the ID for verification in your app code. For more information, see Use webhooks.
- Retrieve sandbox app credentials: To integrate and test Afterpay payments, you need the following sandbox credentials:
- Client ID: App identifier for authentication.
- Client Secret: App credential for authorization.
- To retrieve the sandbox credentials:
- Go to your PayPal developer account and switch to Sandbox.
- Go to Apps & Credentials > API Credentials > REST API apps.
- Copy the Client ID and Client Secret listed next to your app name and save them.
- Retrieve sandbox account credentials: To test your Afterpay integration end-to-end, run your app, simulate a checkout flow, log in to your personal PayPal account to approve the Afterpay payment, and confirm that money is received in your business PayPal account. You need sandbox login credentials for both accounts. For information on accessing or resetting these credentials, see Get sandbox account credentials.
- Set up the development environment.
Set up production business account
- Log in to the PayPal Developer Dashboard and switch to the Live environment.
- Go to Apps & Credentials and create a new app or select an existing app.
- In the app's Features tab, ensure Accept payments is enabled.
- Configure a webhook listener for the app and subscribe to events:
- On the app details page, go to Live Webhooks.
- Select Add Webhook.
- Enter your Webhook URL (the server endpoint where notifications from PayPal are sent), select the events the app wants to subscribe to, and select Save.
- [Recommended] Subscribe to the following events:
CHECKOUT.ORDER.COMPLETED: Successful Afterpay paymentPAYMENT.CAPTURE.DENIED: Failed capture
- Click Save. A Webhook ID will be generated.
The webhook listener is successfully configured, and a Webhook ID is displayed. You can store the ID and use it in your app code to verify the source sending messages to your listener. For more information on webhooks, see Use webhooks.
- Configure a webhook listener for the app and subscribe to events:
- Copy your Client ID and Secret for the live app.
- Complete Afterpay certification before going live (contact your Afterpay Account manager to begin the process).
- Enable Afterpay for the production account.
Onboard Afterpay payments
You can enable Afterpay using one of the following methods:
Enable Afterpay from your PayPal dashboard
If you have an eligible PayPal business account with KYC verification completed, you can enable Afterpay directly from your dashboard:
- Log in to your PayPal business account.
- Go to Account Settings > Products & Services > Payment Methods.
- Find Afterpay and select Get Started.
- Complete KYC requirements and follow the prompts to complete onboarding and activate Afterpay payments on your accounts.
Once enabled, go to Payment Options to manage your Afterpay settings or continue integration.
Request approval to enable Afterpay
If you don't see Afterpay in your dashboard, contact your PayPal account manager to enable Afterpay payments for your business account. Afterpay payments are activated after PayPal verifies eligibility and completes a compliance review.
Partner information - Onboard merchants
As a partner, you can onboard your merchants to accept Afterpay as a payment method. You can also build the onboarding process into your software.
Use a valid access token and send a POST request to /v2/customer/partner-referrals with all required request parameters to generate a sign-up link that directs your merchants to PayPal onboarding. Ensure to include your merchant's information in the API call to pre-fill the PayPal sign-up flow.
Note: To accept Afterpay payments, set products to ["AFTERPAY"]. This is only supported with the v2 Partner Referrals API.
- Sample request
- Sample response
1curl -v -X POST https://api-m.sandbox.paypal.com/v2/customer/partner-referrals \2 -H "Content-Type: application/json" \3 -H "Authorization: Bearer <Access-Token>" \4 -H "PayPal-Partner-Attribution-Id: <BN-CODE>" \5 -d '{6 "email": "[email protected]",7 "preferred_language_code": "en-{{country_code}}",8 "tracking_id": "{{tracking_id}}",9 "partner_config_override": {10 "partner_logo_url": "https://www.paypalobjects.com/webstatic/mktg/logo/pp_cc_mark_111x69.jpg",11 "return_url": "https://testenterprises.com/merchantonboarded",12 "return_url_description": "the url to return the merchant after the paypal onboarding process.",13 "action_renewal_url": "https://testenterprises.com/renew-exprired-url",14 "show_add_credit_card": true15 },16 "individual_owners": [17 {18 "names": [19 {20 "prefix": "Mr.",21 "given_name": "John",22 "surname": "Doe",23 "middle_name": "Middle",24 "suffix": "Jr.",25 "full_name": "first Middle Doe Jr.",26 "type": "LEGAL"27 }28 ],29 "citizenship": "{{country_code}}",30 "addresses": [31 {32 "address_line_1": "006590 Ocean Bay Plaza #25",33 "address_line_2": "Apt 100",34 "admin_area_2": "Pencil Bluff",35 "admin_area_1": "AR",36 "postal_code": "71965",37 "type": "HOME",38 "country_code":"{{country_code}}"39 }40 ],41 "type": "PRIMARY"42 }43 ],44 "business_entity": {45 "business_type": {46 "type": "INDIVIDUAL",47 "subtype": "ASSO_TYPE_INCORPORATED"48 },49 "business_industry": {50 "category": "1004",51 "mcc_code": "8111",52 "subcategory": "8931"53 },54 "business_incorporation": {55 "incorporation_country_code": "{{country_code}}",56 "incorporation_date": "1986-12-29"57 },58 "names": [59 {60 "business_name": "Test Enterprise",61 "type": "LEGAL_NAME"62 }63 ],64 "emails": [65 {66 "type": "CUSTOMER_SERVICE",67 "email": "[email protected]"68 }69 ],70 "website": "https://mystore.testenterprises.com",71 "addresses": [72 {73 "address_line_1": "006590 Ocean Bay Plaza #25",74 "address_line_2": "Apt 100",75 "admin_area_2": "Pencil Bluff",76 "admin_area_1": "AR",77 "postal_code": "71965",78 "country_code": "{{country_code}}",79 "type": "WORK"80 }81 ],82 "phones": [83 {84 "country_code": "1",85 "national_number": "9177270835",86 "extension_number": "1234",87 "type": "CUSTOMER_SERVICE"88 }89 ],90 "beneficial_owners": {91 "individual_beneficial_owners": [92 {93 "names": [94 {95 "prefix": "Mr.",96 "given_name": "John",97 "surname": "Doe",98 "middle_name": "Middle",99 "suffix": "Jr.",100 "full_name": "John Middle Doe Jr.",101 "type": "LEGAL"102 }103 ],104 "citizenship": "{{country_code}}",105 "addresses": [106 {107 "address_line_1": "006590 Ocean Bay Plaza #25",108 "address_line_2": "Apt 100",109 "admin_area_2": "Pencil Bluff",110 "admin_area_1": "AR",111 "postal_code": "71965",112 "type": "HOME",113 "country_code": "{{country_code}}"114 }115 ],116 "phones": [117 {118 "country_code": "1",119 "national_number": "9177270835",120 "extension_number": "1234",121 "type": "MOBILE"122 }123 ],124 "birth_details": {125 "date_of_birth": "1995-12-29"126 },127 "percentage_of_ownership": "50"128 }129 ],130 "business_beneficial_owners": [131 {132 "business_type": {133 "type": "INDIVIDUAL",134 "subtype": "ASSO_TYPE_INCORPORATED"135 },136 "business_industry": {137 "category": "1004",138 "mcc_code": "2025",139 "subcategory": "8931"140 },141 "business_incorporation": {142 "incorporation_country_code": "{{country_code}}",143 "incorporation_date": "1986-12-29"144 },145 "names": [146 {147 "business_name": "Test Enterprise",148 "type": "LEGAL_NAME"149 }150 ],151 "emails": [152 {153 "type": "CUSTOMER_SERVICE",154 "email": "[email protected]"155 }156 ],157 "website": "https://mystore.testenterprises.com",158 "addresses": [159 {160 "address_line_1": "006590 Ocean Bay Plaza #25",161 "address_line_2": "Apt 100",162 "admin_area_2": "Pencil Bluff",163 "admin_area_1": "AR",164 "postal_code": "71965",165 "country_code": "{{country_code}}",166 "type": "WORK"167 }168 ],169 "phones": [170 {171 "country_code": "1",172 "national_number": "9177270835",173 "extension_number": "1234",174 "type": "CUSTOMER_SERVICE"175 }176 ],177 "percentage_of_ownership": "50"178 }179 ]180 },181 "office_bearers": [182 {183 "names": [184 {185 "prefix": "Mr.",186 "given_name": "John",187 "surname": "Doe",188 "middle_name": "Middle",189 "suffix": "Jr.",190 "full_name": "John Middle Doe Jr.",191 "type": "LEGAL"192 }193 ],194 "citizenship": "{{country_code}}",195 "addresses": [196 {197 "address_line_1": "79 Sheppard Ave",198 "address_line_2": "Apt 123",199 "admin_area_2": "Toronto",200 "admin_area_1": "Ontario",201 "postal_code": "M1S 1T4",202 "country_code": "{{country_code}}",203 "type": "HOME"204 }205 ],206 "phones": [207 {208 "country_code": "1",209 "national_number": "4168374117",210 "extension_number": "1234",211 "type": "MOBILE"212 }213 ],214 "birth_details": {215 "date_of_birth": "1955-12-29"216 },217 "role": "DIRECTOR"218 }219 ],220 "annual_sales_volume_range": {221 "minimum_amount": {222 "currency_code": "USD",223 "value": "10000"224 },225 "maximum_amount": {226 "currency_code": "USD",227 "value": "50000"228 }229 },230 "average_monthly_volume_range": {231 "minimum_amount": {232 "currency_code": "USD",233 "value": "1000"234 },235 "maximum_amount": {236 "currency_code": "USD",237 "value": "50000"238 }239 },240 "purpose_code": "P0104"241 },242 "operations": [243 {244 "operation": "API_INTEGRATION",245 "api_integration_preference": {246 "rest_api_integration": {247 "integration_method": "PAYPAL",248 "integration_type": "THIRD_PARTY",249 "third_party_details": {250 "features": [251 "PAYMENT",252 "REFUND"253 ]254 }255 }256 }257 }258 ],259 "products": [260 "AFTERPAY"261262 ],263 "legal_consents": [264 {265 "type": "SHARE_DATA_CONSENT",266 "granted": true267 }268 ]269}
Request and response parameters
Select a tab to view either the required request parameters or the expected response parameters for order creation.
Request parameters
| Parameter name | Description |
|---|---|
tracking_idstring |
Partner's unique identifier for this merchant. Use this ID to track the status of your merchant as they complete onboarding. |
business_entityRequired, object |
Merchant's business details, including type, industry classification, incorporation information, and addresses. |
business_entity.business_typeRequired, object |
Business structure classification with type and subtype for legal entity identification. |
business_entity.business_industryRequired, object |
Industry classification details including category, MCC code, and subcategory for business categorization. |
business_entity.business_incorporationRequired, object |
Incorporation information including country code and date of incorporation. |
business_entity.namesRequired, array |
Business legal name registration for official identification. |
business_entity.addressesRequired, array |
Business location details for verification and compliance. |
business_entity.annual_sales_volume_rangeRequired, object |
Expected annual transaction volume range in local currency for risk assessment. |
business_entity.average_monthly_volume_rangeRequired, object |
Expected monthly transaction volume range in local currency for account configuration. |
business_entity.purpose_codeRequired, string |
Business purpose classification code for regulatory compliance. |
operationsRequired, array |
API integration preferences and configuration for technical setup. |
productsRequired, array |
PayPal products to enable for the merchant. For Afterpay payments, set to AFTERPAY. |
legal_consentsRequired, array |
Consents received from the merchant. If SHARE_DATA_CONSENT is not granted, PayPal does not store the customer data. |
Note: When you send a GET request to /v2/customer/partner-referrals/{partner_referral_id}, the response only includes the user data you provided for the merchant. It does not include any information the merchant may have entered directly on PayPal.com.
Partner specific information
If you are a platform, pass the build notation (BN) code of the partner in the PayPal-Partner-Attribution-Id header for server-side calls to the Orders API. PayPal uses this information for reporting and tracking purposes. To find your BN code, see Code and Credential Reference.
Onboard merchants using URLs
URL onboarding is a process where merchants are redirected to a specific PayPal sign-up URL to complete their onboarding. Use URL onboarding only if you have previously onboarded merchants with this method or have a specific use case for it.
The URL contains parameters that pre-fill merchant information and configures the onboarding flow for required products. Merchants must complete all required fields and have a PayPal business account to finish onboarding. Casual merchants are not supported.