PayBright has been acquired by Affirm. Adyen will not accept new PayBright integrations.
Our Android Drop-in renders PayBright in your payment form, and redirects the shopper to complete the payment. As with other redirect payment methods, you need to check the payment result after the shopper returns to your app.
When making an PayBright payment, you also need to:
- Collect shopper details, and specify these in your payment request. PayBright uses these for risk checks.
- Provide information about the purchased items by specifying
lineItems
in your payment request. - Handle the redirect result after the shopper returns to your website.
Requirements
Requirement | Description |
---|---|
Integration type | Make sure that you have built an Advanced flow Android Drop-in integration. |
Setup steps | Before you begin, add PayBright in your Customer Area. |
Show PayBright in your payment form
Drop-in uses the countryCode
and the amount.currency
from your /paymentMethods request to show the available payment methods to your shopper.
To show PayBright in your payment form, specify in your /paymentMethods request:
- countryCode: CA
- amount.currency: CAD
- amount.value: The value of the payment, in minor units.
When the shopper proceeds to pay, Drop-in returns the paymentComponentData.paymentMethod
. Pass the paymentComponentData.paymentMethod
to your server — these are the shopper details that you need to make the payment.
Make a payment
-
From your server, make a POST /payments request, specifying:
paymentMethod
: ThepaymentComponentData.paymentMethod
from your client app.- shopperName: The shopper's full name.
- dateOfBirth: The shopper's date of birth.
- shopperEmail: The shopper's email address.
- telephoneNumber: The shopper's phone number.
- shopperLocale: A combination of language code and country code to define which language should be used in the PayBright checkout page.Optional
- countryCode: The shopper's country. For example,
CA
. - billingAddress: The postal address to be included on the invoice.
- deliveryAddress: The postal address where the purchased items will be shipped.
- lineItems: Price and product information about the purchased items.
- returnUrl: URL to where the shopper should be redirected back to after they complete the payment. Get this URL from the Component in the
RedirectComponent.getReturnUrl(context)
.
curl https://checkout-test.adyen.com/v68/payments \ -H 'x-api-key: ADYEN_API_KEY' \ -H 'content-type: application/json' \ -d '{ "merchantAccount": "ADYEN_MERCHANT_ACCOUNT", "reference": "YOUR_ORDER_REFERENCE", "paymentMethod": { "type": "paybright" }, "amount": { "value": 6000, "currency": "CAD" }, "shopperLocale": "en_CA", "countryCode": "CA", "telephoneNumber": "+16478491378", "shopperEmail": "s.hopper@adyen.com", "dateOfBirth": "1970-07-10", "shopperName": { "firstName": "Simon", "lastName": "Hopper" }, "billingAddress": { "city": "Toronto", "country": "CA", "houseNumberOrName": "240", "postalCode": "M5V 2C5", "street": "Richmond St W", "stateOrProvince": "ON" }, "deliveryAddress": { "city": "Toronto", "country": "CA", "houseNumberOrName": "240", "postalCode": "M5V 2C5", "street": "Richmond St W", "stateOrProvince": "ON" }, "lineItems": [ { "description": "Shoes", "quantity": "1", "amountIncludingTax": "4000", "amountExcludingTax": "3310", "taxCategory": "Low" }, { "description": "Socks", "quantity": "2", "amountIncludingTax": "3000", "amountExcludingTax": "2480", "taxCategory": "Low" }, { "description": "Discount", "amountExcludingTax": "-1000", "amountIncludingTax": "-1000", "quantity": "1", "taxCategory": "Low" } ], "returnUrl": "https://your-company.com/checkout?shopperOrder=12xy.." }'
The /payments response includes the action
object with information that you must use to redirect the shopper.
{ "resultCode":"RedirectShopper", "action":{ "paymentMethodType":"paybright", "method":"GET", "url":"https://checkoutshopper-test.adyen.com/checkoutshopper/checkoutPaymentRedirect?redirectData=...", "type":"redirect" } }
If your integration is set up correctly, the action
object is passed from your server to the client.
Handle the redirect
Drop-in redirects the shopper to complete the payment. When the shopper returns back to your app, Drop-in provides the actionComponentData
object.
From your server, make a POST /payments/details request providing:
details
: TheactionComponentData.details
object from Drop-in.
curl https://checkout-test.adyen.com/v68/payments/details \ -H 'x-api-key: ADYEN_API_KEY' \ -H 'content-type: application/json' \ -d '{ "details": { "redirectResult": "eyJ0cmFuc1N0YXR1cyI6IlkifQ==" } }'
You receive a response containing:
resultCode
: Use this to present the payment result to your shopper.pspReference
: Our unique identifier for the transaction.
{ "resultCode": "Authorised", "pspReference": "PPKFQ89R6QRXGN82" }
Present the payment result
Use the resultCode
that you received in the /payments/details response to present the payment result to your shopper.
The resultCode
values you can receive for PayBright are:
resultCode | Description | Action to take |
---|---|---|
Authorised | The payment was successful. | Inform the shopper that the payment was successful. |
Cancelled | The shopper cancelled the payment. | Ask the shopper whether they want to continue with the order, or ask them to select a different payment method. |
Refused | The payment was refused by PayBright. | Ask the shopper to try the payment again using a different payment method. |
If the shopper failed to return to your website or app, wait for webhooks to know the outcome of the payment:
eventCode | success field | Description | Action to take |
---|---|---|---|
AUTHORISATION | false | The transaction failed. | Cancel the order and inform the shopper that the payment failed. |
AUTHORISATION | true | The shopper successfully completed the payment. | Inform the shopper that the payment has been successful and proceed with the order. |
Capture the payment
By default, all PayBright payments are captured automatically after authorisation.
If you prefer to capture the payment after the goods have been sent, or when you want to partially capture payments, you need to set up a capture delay or use manual capture.
When you capture the payment, the shopper is charged for the first installment.
Partial captures
Partial captures are not available if you enabled automatic capture in your Customer Area.
To partially capture a PayBright payment, specify in your /capture request:
modificationAmount
: The amount that the shopper should pay.additionalData.openinvoicedata
:Price and product information for the items that the shopper should pay for.Optional
Although the field names are different, the information in additionalData.openinvoicedata
is the same as what you provided in lineItems
when making a /payments request:
openinvoicedata | lineItems | Description |
---|---|---|
itemAmount |
amountExcludingTax |
The price for one item, without the tax, in minor units. |
itemVatAmount |
taxAmount |
The tax amount for one item, in minor units. |
The following example shows how to make a partial capture request if the shopper only kept one pair of socks from the two included in the original payment request.
{ "originalReference":"COPY_PSP_REFERENCE_FROM_AUTHORISE_RESPONSE", "merchantAccount":"YOUR_MERCHANT_ACCOUNT", "modificationAmount":{ "currency":"", "value":"4500" }, "additionalData":{ "openinvoicedata.numberOfLines":"2", "openinvoicedata.line1.currencyCode":"", "openinvoicedata.line1.description":"Shoes", "openinvoicedata.line1.itemAmount":"3310", "openinvoicedata.line1.itemVatAmount":"690", "openinvoicedata.line1.numberOfItems":"1", "openinvoicedata.line2.currencyCode":"", "openinvoicedata.line2.description":"Socks", "openinvoicedata.line2.itemAmount":"1240", "openinvoicedata.line2.itemVatAmount":"260", "openinvoicedata.line2.numberOfItems":"1", }, "reference":"YOUR_CAPTURE_REFERENCE" }
Any unclaimed amount that is left over after partially capturing a payment is automatically cancelled. When your account is enabled for multiple partial captures, the unclaimed amount after an initial capture is not automatically cancelled.
To set up multiple partial captures, contact our Support Team. Multiple partial captures will create a new invoice for each capture.
Refunds and cancellations
If a payment has not yet been captured, you can cancel it. If the PayBright payment has already been captured and you want to return the funds to the shopper, you need to refund it.
Partial refunds
To partially refund a payment, specify in your /payments/{paymentPspReference}/refunds request:
modificationAmount
: The amount to be refunded to the shopper.additionalData.openinvoicedata
:Price and product information about the returned items.Optional
Providing additionalData.openinvoicedata
is optional, and although the field names are different, the information is the same as what you provided in lineItems
when making a /payments request:
openinvoicedata | lineItems | Description |
---|---|---|
itemAmount |
amountExcludingTax |
The price for one item, without the tax, in minor units. |
itemVatAmount |
taxAmount |
The tax amount for one item, in minor units. |
The following example shows how to make a partial refund request if the shopper returned the shoes included in the original payment request.
{ "merchantAccount":"YOUR_MERCHANT_ACCOUNT", "originalReference":"COPY_PSP_REFERENCE_FROM_AUTHORISE_RESPONSE", "modificationAmount":{ "currency":"", "value":"4000" }, "additionalData":{ "openinvoicedata.numberOfLines":"1", "openinvoicedata.line1.currencyCode":"", "openinvoicedata.line1.description":"Shoes", "openinvoicedata.line1.itemAmount":"3310", "openinvoicedata.line1.itemVatAmount":"690", "openinvoicedata.line1.numberOfItems":"1" }, "reference":"YOUR_REFUND_REFERENCE" }
Test and go live
To test PayBright payments, use the test details provided in the PayBright developer documentation.
You can check the status of test payments in your Customer Area > Transactions > Payments.
Before you can accept live PayBright payments, you need to submit a request for PayBright in your live Customer Area.