--- title: "API only integration" description: "Learn how to add Indonesian payment methods to an existing API-only integration for mobile and web banking." url: "https://docs.adyen.com/payment-methods/doku/doku-api-only" source_url: "https://docs.adyen.com/payment-methods/doku/doku-api-only.md" canonical: "https://docs.adyen.com/payment-methods/doku/doku-api-only" last_modified: "2019-11-12T17:24:00+01:00" language: "en" --- # API only integration Learn how to add Indonesian payment methods to an existing API-only integration for mobile and web banking. [View source](/payment-methods/doku/doku-api-only.md) On this page, you can find information for accepting DOKU payment methods using our APIs, and build your own payment form to have full control over the look and feel of your checkout page. Through our partner DOKU, we offer various [bank transfer payment methods](/payment-methods/doku#bank-transfer) and [convenience store payment methods](/payment-methods/doku#convenience-store) in Indonesia. ## Requirements | Requirement | Description | | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | **Integration type** | Make sure that you have built an [API-only integration](/online-payments/build-your-integration/advanced-flow?platform=Web\&integration=API%20only). | | **Setup steps** | Before you begin, [add in your test Customer Area](/payment-methods/add-payment-methods). | ## Build your payment form To make a payment, you need to collect the following shopper details: | Name | Description | | -------------- | ------------------------ | | `firstName` | Shopper's first name. | | `lastName` | Shopper's last name. | | `shopperEmail` | Shopper's email address. | We provide logos for the different payment method types which you can use in your payment form. For more information, refer to [Downloading logos](/online-payments/build-your-integration/advanced-flow/?platform=Web\&integration=API%20only#downloading-logos). You can also get the required fields from the [/paymentMethods](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods) response as explained in our [API-only integration guide](/online-payments/build-your-integration/advanced-flow/?platform=Web\&integration=API%20only\&version=71#get-available-payment-methods). In your [/paymentMethods](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods) request, specify the following combination of [countryCode](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods) and [amount.currency](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods#request-amount): | Country/region | `countryCode` | `amount.currency` | | -------------- | ------------- | ----------------- | | Indonesia | **ID** | **IDR** | The required fields for different Doku payments are included in the object with the `type` that you want to integrate with. | `name` | `type` | Kind of payment method | | ----------------------- | -------------------------------------------------- | ---------------------- | | Alfamart | doku\_alfamart | Convenience store | | Bank Transfer (Permata) | doku\_permata\_lite\_atm | Bank transfer | | BCA Bank Transfer | doku\_bca\_va (only available with a local entity) | Bank transfer | | BNI VA | doku\_bni\_va | Bank transfer | | BRI VA | doku\_bri\_va (only available with a local entity) | Bank transfer | | CIMB VA | doku\_cimb\_va | Bank transfer | | Danamon VA | doku\_danamon\_va | Bank transfer | | Indomaret | doku\_indomaret | Convenience store | | Mandiri VA | doku\_mandiri\_va | Bank transfer | ## Make a payment From your server, make a [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) request, specifying: * `paymentMethod.type`: The `type` of payment method, for example, **doku\_alfamart**. * `paymentMethod.firstName`: The shopper's first name. * `paymentMethod.lastName`: The shopper's last name. * `paymentMethod.shopperEmail`: The shopper's email address. * `amount.value`: The amount of the transaction, in [minor units](/development-resources/currency-codes) without decimals. For example, submit a value of 10000 IDR as *10000*. #### curl ```bash 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_NUMBER", "amount":{ "currency":"IDR", "value":10000 }, "paymentMethod":{ "type":"doku_alfamart", "firstName":"John", "lastName":"Smith", "shopperEmail":"1212@aaa.com" }, "returnUrl":"https://staging.doku.com/Suite/Receive" }' ``` #### Java ```java // Adyen Java API Library v27.0.0 import com.adyen.Client; import com.adyen.enums.Environment; import com.adyen.model.checkout.*; import java.time.OffsetDateTime; import java.util.*; import com.adyen.model.RequestOptions; import com.adyen.service.checkout.*; // For the live environment, additionally include your liveEndpointUrlPrefix. Client client = new Client("ADYEN_API_KEY", Environment.TEST); // Create the request object(s) Amount amount = new Amount() .currency("IDR") .value(10000L); DokuDetails dokuDetails = new DokuDetails() .firstName("John") .lastName("Smith") .shopperEmail("1212@aaa.com") .type(DokuDetails.TypeEnum.ALFAMART); PaymentRequest paymentRequest = new PaymentRequest() .reference("YOUR_ORDER_NUMBER") .amount(amount) .merchantAccount("ADYEN_MERCHANT_ACCOUNT") .paymentMethod(new CheckoutPaymentMethod(dokuDetails)) .returnUrl("https://staging.doku.com/Suite/Receive"); // Send the request PaymentsApi service = new PaymentsApi(client); PaymentResponse response = service.payments(paymentRequest, new RequestOptions().idempotencyKey("UUID")); ``` #### PHP ```php // Adyen PHP API Library v19.0.0 use Adyen\Client; use Adyen\Environment; use Adyen\Model\Checkout\Amount; use Adyen\Model\Checkout\CheckoutPaymentMethod; use Adyen\Model\Checkout\PaymentRequest; use Adyen\Service\Checkout\PaymentsApi; $client = new Client(); $client->setXApiKey("ADYEN_API_KEY"); // For the live environment, additionally include your liveEndpointUrlPrefix. $client->setEnvironment(Environment::TEST); // Create the request object(s) $amount = new Amount(); $amount ->setCurrency("IDR") ->setValue(10000); $checkoutPaymentMethod = new CheckoutPaymentMethod(); $checkoutPaymentMethod ->setFirstName("John") ->setLastName("Smith") ->setShopperEmail("1212@aaa.com") ->setType("alfamart"); $paymentRequest = new PaymentRequest(); $paymentRequest ->setReference("YOUR_ORDER_NUMBER") ->setAmount($amount) ->setMerchantAccount("ADYEN_MERCHANT_ACCOUNT") ->setPaymentMethod($checkoutPaymentMethod) ->setReturnUrl("https://staging.doku.com/Suite/Receive"); $requestOptions['idempotencyKey'] = 'UUID'; // Send the request $service = new PaymentsApi($client); $response = $service->payments($paymentRequest, $requestOptions); ``` #### C\# ```cs // Adyen .net API Library v17.0.0 using Adyen; using Environment = Adyen.Model.Environment; using Adyen.Model; using Adyen.Model.Checkout; using Adyen.Service.Checkout; // For the live environment, additionally include your liveEndpointUrlPrefix. var config = new Config() { XApiKey = "ADYEN_API_KEY", Environment = Environment.Test }; var client = new Client(config); // Create the request object(s) Amount amount = new Amount { Currency = "IDR", Value = 10000 }; DokuDetails dokuDetails = new DokuDetails { FirstName = "John", LastName = "Smith", ShopperEmail = "1212@aaa.com", Type = DokuDetails.TypeEnum.Alfamart }; PaymentRequest paymentRequest = new PaymentRequest { Reference = "YOUR_ORDER_NUMBER", Amount = amount, MerchantAccount = "ADYEN_MERCHANT_ACCOUNT", PaymentMethod = new CheckoutPaymentMethod(dokuDetails), ReturnUrl = "https://staging.doku.com/Suite/Receive" }; // Send the request var service = new PaymentsService(client); var response = service.Payments(paymentRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"}); ``` #### NodeJS (JavaScript) ```js // Adyen Node API Library v18.0.0 // Require the parts of the module you want to use const { Client, CheckoutAPI } = require('@adyen/api-library'); // Initialize the client object // For the live environment, additionally include your liveEndpointUrlPrefix. const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"}); // Create the request object(s) const paymentRequest = { merchantAccount: "ADYEN_MERCHANT_ACCOUNT", reference: "YOUR_ORDER_NUMBER", amount: { currency: "IDR", value: 10000 }, paymentMethod: { type: "doku_alfamart", firstName: "John", lastName: "Smith", shopperEmail: "1212@aaa.com" }, returnUrl: "https://staging.doku.com/Suite/Receive" } // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` #### Go ```go // Adyen Go API Library v10.4.0 import ( "context" "github.com/adyen/adyen-go-api-library/v9/src/common" "github.com/adyen/adyen-go-api-library/v9/src/adyen" "github.com/adyen/adyen-go-api-library/v9/src/checkout" ) // For the live environment, additionally include your liveEndpointUrlPrefix. client := adyen.NewClient(&common.Config{ ApiKey: "ADYEN_API_KEY", Environment: common.TestEnv, }) // Create the request object(s) amount := checkout.Amount{ Currency: "IDR", Value: 10000, } dokuDetails := checkout.DokuDetails{ FirstName: "John", LastName: "Smith", ShopperEmail: "1212@aaa.com", Type: "doku_alfamart", } paymentRequest := checkout.PaymentRequest{ Reference: "YOUR_ORDER_NUMBER", Amount: amount, MerchantAccount: "ADYEN_MERCHANT_ACCOUNT", PaymentMethod: checkout.DokuDetailsAsCheckoutPaymentMethod(&dokuDetails), ReturnUrl: "https://staging.doku.com/Suite/Receive", } // Send the request service := client.Checkout() req := service.PaymentsApi.PaymentsInput().IdempotencyKey("UUID").PaymentRequest(paymentRequest) res, httpRes, err := service.PaymentsApi.Payments(context.Background(), req) ``` #### Python ```py # Adyen Python API Library v12.5.1 import Adyen adyen = Adyen.Adyen() adyen.client.xapikey = "ADYEN_API_KEY" # For the live environment, additionally include your liveEndpointUrlPrefix. adyen.client.platform = "test" # The environment to use library in. # Create the request object(s) json_request = { "merchantAccount": "ADYEN_MERCHANT_ACCOUNT", "reference": "YOUR_ORDER_NUMBER", "amount": { "currency": "IDR", "value": 10000 }, "paymentMethod": { "type": "doku_alfamart", "firstName": "John", "lastName": "Smith", "shopperEmail": "1212@aaa.com" }, "returnUrl": "https://staging.doku.com/Suite/Receive" } # Send the request result = adyen.checkout.payments_api.payments(request=json_request, idempotency_key="UUID") ``` #### Ruby ```rb # Adyen Ruby API Library v9.5.1 require "adyen-ruby-api-library" adyen = Adyen::Client.new adyen.api_key = 'ADYEN_API_KEY' # For the live environment, additionally include your liveEndpointUrlPrefix. adyen.env = :test # Set to "live" for live environment # Create the request object(s) request_body = { :merchantAccount => 'ADYEN_MERCHANT_ACCOUNT', :reference => 'YOUR_ORDER_NUMBER', :amount => { :currency => 'IDR', :value => 10000 }, :paymentMethod => { :type => 'doku_alfamart', :firstName => 'John', :lastName => 'Smith', :shopperEmail => '1212@aaa.com' }, :returnUrl => 'https://staging.doku.com/Suite/Receive' } # Send the request result = adyen.checkout.payments_api.payments(request_body, headers: { 'Idempotency-Key' => 'UUID' }) ``` #### NodeJS (TypeScript) ```ts // Adyen Node API Library v18.0.0 // Require the parts of the module you want to use import { Client, CheckoutAPI, Types } from "@adyen/api-library"; // Initialize the client object // For the live environment, additionally include your liveEndpointUrlPrefix. const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"}); // Create the request object(s) const amount: Types.checkout.Amount = { currency: "IDR", value: 10000 }; const dokuDetails: Types.checkout.DokuDetails = { firstName: "John", lastName: "Smith", shopperEmail: "1212@aaa.com", type: Types.checkout.DokuDetails.TypeEnum.Alfamart }; const paymentRequest: Types.checkout.PaymentRequest = { reference: "YOUR_ORDER_NUMBER", amount: amount, merchantAccount: "ADYEN_MERCHANT_ACCOUNT", paymentMethod: dokuDetails, returnUrl: "https://staging.doku.com/Suite/Receive" }; // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` The [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) response contains: * `resultCode`: **PresentToShopper** * `action`: Object containing information about the voucher. **/payments response** ```json { "resultCode": "PresentToShopper", "action": { "expiresAt": "2019-07-21T16:59:00", "initialAmount": { "currency": "IDR", "value": 10000 }, "instructionsUrl": "...", "merchantName": "YOUR_MERCHANT_NAME", "paymentMethodType": "doku_alfamart", "reference": "888882603010314", "shopperEmail": "1212@aaa.com", "shopperName": "J Smith", "totalAmount": { "currency": "IDR", "value": 10000 }, "type": "voucher" } } ``` ## Present the payment result Because the voucher is an offline payment method, there is no need to handle the redirect back from the acquirer. We send you a [webhook](/development-resources/webhooks) informing you about the payment status. The `eventCode` [values](/development-resources/webhooks/webhook-types#event-codes) you receive with your notification are: | eventCode | success field | Description | Action to take | resultCode | | ----------------- | ------------- | ------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | -------------------- | | **PENDING** | **true** | The voucher reference is successfully created and the transaction is pending. | Present the shopper with the voucher and wait for the payment. | **PresentToShopper** | | **AUTHORISATION** | **false** | The voucher reference is not successfully generated and the transaction failed. | Cancel the order and inform the shopper that the payment failed. | **Error** | | **AUTHORISATION** | **true** | The shopper successfully completed the payment. | Inform the shopper that the payment has been successful and proceed with the order. | **PresentToShopper** | | **OFFER\_CLOSED** | **true** | The shopper did not complete the payment before the voucher expired. | Cancel the order and inform the shopper that the payment timed out. | **PresentToShopper** | ## Customization You can customize the expiry date of the virtual bank account (for bank transfers) or the voucher (for convenience store payments). By default, the validity period is 48 hours. To change the validity period, contact the [Support Team](https://ca-test.adyen.com/ca/ca/contactUs/support.shtml?form=other). ## Test and go live Use our [test vouchers and card numbers](/development-resources/test-cards-and-credentials/alternative-payment-method-credentials#doku) to simulate the payments. Check the status of the test payments in your [Customer Area](https://ca-test.adyen.com/), under **Transactions** > **Payments**. Before you can accept live payments, you need to [submit a request](/payment-methods/add-payment-methods) for one or more Indonesian DOKU online banking or convenience store payment methods in your [live Customer Area](https://ca-live.adyen.com/). ## See also * [API only integration guide](/online-payments/api-only) * [Webhooks](/development-resources/webhooks) * [API Explorer](https://docs.adyen.com/api-explorer/#/CheckoutService/latest/overview)