Payment-method icon

GoPay Redirect Component

Add GoPay to an existing iOS Components integration.

This page explains how to add GoPay to your existing iOS Components integration.

Requirements

Select the server-side flow that your integration uses:

Requirement Description
Integration type Make sure that you have built a Sessions flow iOS Components integration.
Setup steps Before you begin, add GoPay in your Customer Area.

API reference

Select which endpoint you are using:

This is the default with Components v5.0.0 or later.

Parameter name Required Description
browserInfo -white_check_mark- Information about the shopper's browser.
channel -white_check_mark- Set to Web.
Expand view
Copy link to code block
Copy code
Copy code
curl https://checkout-test.adyen.com/v68/payments \
-H 'x-api-key: ADYEN_API_KEY' \
-H 'content-type: application/json' \
-d '{
"merchantAccount":"YOUR_MERCHANT_ACCOUNT",
"reference":"YOUR_ORDER_NUMBER",
"amount":{
"currency":"IDR",
"value":1000
},
"browserInfo":{
"userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
"acceptHeader":"text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
"language":"en-ID",
"colorDepth":24,
"screenHeight":723,
"screenWidth":1536,
"timeZoneOffset":0,
"javaEnabled":false
},
"channel":"iOS",
"returnUrl":"my-app://adyen"
}'

Component configuration

v5.0.0 or later

If your integration uses iOS Components v5.0.0 or later, configure and create an instance of the GoPay Component:

Component configuration
Expand view
Copy link to code block
Copy code
Copy code
let paymentMethods = session.sessionContext.paymentMethods
// Check that the payment method is supported before showing the Component.
guard let paymentMethod = paymentMethods.paymentMethod(ofType: .other("gopay_wallet")) else { return }
let component = InstantPaymentComponent(paymentMethod: paymentMethod,
context: context,
order: nil)
self.currentComponent = component
// Set the session as the delegate.
component.delegate = session
component.initiatePayment()

v4.x.x

If your integration uses an earlier version of iOS Components:

Component configuration
Expand view
Copy link to code block
Copy code
Copy code
// Check that the payment method is supported before showing the Component.
guard let paymentMethod = paymentMethods.paymentMethod(ofType: GoPayPaymentMethod.self) else { return }
let style = FormComponentStyle()
let component = GoPayComponent(paymentMethod: paymentMethod,
apiContext: context,
style: style)
present(component)

There are no configuration steps specific to GoPay required for Components.

Recurring payments

GoPay supports recurring payments. The first time your shopper makes a payment, you need to create a token, which you can use later to make Subscription or CardOnFile payments. Note that the flows for Subscription and CardOnFile payments are different.

Create a token

To create a token, include in your /payments request:

When the payment has been settled, you receive a webhook containing:

  • eventCode: RECURRING_CONTRACT
  • originalReference: The pspReference of the initial payment.
  • pspReference: This is the token that you need to make recurring payments for this shopper.

Make sure that your server is able to receive RECURRING_CONTRACT as part of your standard webhooks. You can enable the RECURRING_CONTRACT event code in the webhook settings page.

Make a Subscription payment with a token

To make a recurring Subscription payment with a token, make a /payments request and include:

  • paymentMethod.storedPaymentMethodId: The shopper's payment token.

    You can also get this value using the /listRecurringDetails endpoint.

  • shopperReference: Your unique identifier for the shopper.

  • shopperInteraction: ContAuth

  • recurringProcessingModel: Subscription

    Expand view
    Copy link to code block
    Copy code
    Copy code
    curl https://checkout-test.adyen.com/v68/payments \
    -H 'x-api-key: ADYEN_API_KEY' \
    -H 'content-type: application/json' \
    -d '{
    "amount":{
    "value":10000,
    "currency":"IDR"
    },
    "paymentMethod":{
    "type":"gopay_wallet",
    "storedPaymentMethodId":"7219687191761347"
    },
    "reference":"YOUR_ORDER_NUMBER",
    "merchantAccount":"YOUR_MERCHANT_ACCOUNT",
    "shopperReference":"YOUR_UNIQUE_SHOPPER_ID",
    "shopperInteraction":"ContAuth",
    "recurringProcessingModel": "Subscription",
    "returnUrl": "my-app://adyen"
    }'

The /payments response contains:
resultCode: Use this to show your shopper the payment result.

When the payment is processed, you receive the final status of the payment in a webhook containing:

  • eventCode: AUTHORISATION
  • success: true

Make a recurring CardOnFile payment with a token

Recurring CardOnFile payments with GoPay go through a challenge flow to reduce the likelihood of fraudulent transactions. You must redirect the shopper to GoPay so they can enter their PIN.
To make a recurring CardOnFile payment with a token, make a /payments request and include:

  • paymentMethod.storedPaymentMethodId: The shopper's payment token.

    You can also get this value using the /listRecurringDetails endpoint.

  • shopperReference: Your unique identifier for the shopper.

  • shopperInteraction: ContAuth

  • recurringProcessingModel: CardOnFile

The /payments response contains:

resultCode: RedirectShopper
action: Contains the url to redirect the shopper to.

When the shopper is redirected back to your page, call /payments/details with the redirectResult to complete the flow and get the status of the payment.

When the payment is processed, you receive a webhook containing the final status of the payment:

  • eventCode: AUTHORISATION
  • success: true

Test and go live

When you want to test GoPay, contact our Support Team.

Refer to GoPay's knowledge base for more information about testing GoPay payments.

Before you can accept live GoPay payments, you need to submit a request for GoPay in your live Customer Area.

See also