This site requires javascript to be enabled.

Troy Debit

Results for

Results for Searching

Integration

Before you begin

To follow along with this guide, please ensure that you have the following ready:

Using MyCheckout hosted payment pages

  1. Make a POST /v1/{merchantId}/hostedcheckouts API call.
  2. Create the order object containing the following elements:
  • amountOfMoney, including amount and currencyCode
  • customer, including merchantCustomerId, billingAddress, and countryCode
  • hostedCheckoutSpecificInput, including the checkout page variant you designed and locale
POST HOSTEDCHECKOUTS REQUEST

{
    "order": {
        "amountOfMoney": {
            "amount": 100,
            "currencyCode": "TRY"
        },
        "customer": {
            "merchantCustomerId": "1234567",
            "billingAddress": {
                "countryCode": "TR"
            }
        }
    },
    "hostedCheckoutSpecificInput": {
        "variant": "124",
        "locale": "tur_TR"
    }
}
POST HOSTEDCHECKOUTS RESPONSE

    {
   "RETURNMAC" : "ed471a7d-4126-45c9-ba08-89c1bde5bcd6",
   "hostedCheckoutId" : "0651ea55-a68e-71ff-a30d-e274bfca236a",
   "partialRedirectUrl" : "pay2.preprod.checkout.worldline-solutions.com/checkout/9991-faa4d336e2384de3bde7ce62beb3f127:065e9dd7-b56e-71ff-8ded-48133a47970b:2dc35d06fa7a43c19b22cca466a50cdd"
}

From the response, the important properties are:

  • hostedCheckoutId can be used in subsequent API calls to retrieve the transaction details, such as GET/v1/{merchantId}/hostedcheckouts/{hostedCheckoutId}
  • partialRedirectUrl is used to create the URL to which the customer needs to be redirected (by default, we configure every account with the subdomain payment, so you can always connect https://payment. with the partialRedirectUrl, for example:

https://payment.pay2.preprod.checkout.worldline-solutions.com/checkout/9991-faa4d336e2384de3bde7ce62beb3f127:065e9dd7-b56e-71ff-8ded-48133a47970b:2dc35d06fa7a43c19b22cca466a50cdd

The hostedCheckoutId is only valid for 2 hours, please ensure to store the createdPaymentOutput.payment.id from the GET /v1/{merchantId}/hostedcheckouts/{hostedCheckoutId} response to be able to retrieve data after 2 hours have elapsed via the GET /v1/{merchantId}/payments/{paymentId} API call. Alternatively, we can also optionally send a webhook event that will contain it.

Using your own checkout page

You can build a direct integration using our SDKs (or integrate our API from scratch). Depending on your integration needs, there are several options available.

Client-side encryption 

Our Client API allows you to perform various actions, such as collecting card data without being PCI SAQ-D compliant. All you need is to be able to create a session via the POST /v1/{merchantId}/sessions API call, which will grant you access to the Client API.

It's highly recommended that you use our Client SDKs, provided for the following programming languages: 

We also have reference implementations showing how to use these SDKs on GitHub.

If you choose not to use our Client SDKs, please use the encryption methods we provide in these SDKs, as it can be a bit tricky to do a custom implementation.

Raw data

If you wish to do a direct server-to-server API call, go for this option. The difference with the other options mentioned before is that you don't need to submit an encryptedCustomerInput property. After the customer selects the payment product, you need to perform the following:

  1. Make a POST /v1/{merchantId}/payments API call.
  2. Create the order object requiring the following properties:
  • amountOfMoney, including amount and currencyCode
  • customer, including billingAddress and countryCode
  1. Create the cardPaymentMethodSpecificInput object requiring the following properties:
  • paymentProductId
  • card, including cardNumber, expiryDate, cvv, and cardholderName 

The cardholderName is often different from the name a customer uses when registering an account. The cardholderName refers to the official name the customer uses with their issuing bank. 

POST PAYMENTS REQUEST

{
    "order": {
        "amountOfMoney": {
            "amount": 100,
            "currencyCode": "TRY"
        },
        "customer": {
            "merchantCustomerId": "1234567",
            "billingAddress": {
                "countryCode": "TR"
            }
        }
    },
    "cardPaymentMethodSpecificInput": {
        "paymentProductId": 189,
        "card": {
            "cvv": "000",
            "cardNumber": "9792052565200015",
            "expiryDate": "0127",
            "cardholderName": "Cevdet Deger"
        }
    }
}
POST PAYMENTS RESPONSE

{
   "creationOutput" : {
      "additionalReference" : "00000997021000000883",
      "externalReference" : "000009970210000008830000100001"
   },
   "payment" : {
      "id" : "000009970210000008830000100001",
      "paymentOutput" : {
         "amountOfMoney" : {
            "amount" : 100,
            "currencyCode" : "TRY"
         },
         "references" : {
            "paymentReference" : "0",
            "providerId" : "4700",
            "providerReference" : "200198342"
         },
         "paymentMethod" : "card",
         "cardPaymentMethodSpecificOutput" : {
            "paymentProductId" : 189,
            "authorisationCode" : "P05419",
            "fraudResults" : {
               "fraudServiceResult" : "no-advice",
               "avsResult" : "0",
               "cvvResult" : "0"
            },
            "card" : {
               "cardNumber" : "************0015",
               "cardholderName" : "Cevdet Deger",
               "expiryDate" : "	0127"
            }
         }
      },
      "status" : "CAPTURE_REQUESTED",
      "statusOutput" : {
         "isCancellable" : false,
         "isRetriable" : false,
         "statusCategory" : "PENDING_CONNECT_OR_3RD_PARTY",
         "statusCode" : 975,
         "statusCodeChangeDateTime" : "20231006005621",
         "isAuthorized" : true,
         "isRefundable" : true
      }
   }
}

Delayed capture

Changing the authorization type modifies the behavior for both the customer and you as a merchant. From the customer's point of view, the key factor that differs is how long the authorization stays valid. This duration may vary slightly depending on the specific payment scheme and industry:

  • Pre-authorizations are valid for ±30 days: you may capture an amount lower than authorized, and you can perform the capture at any time during the authorization period.
  • Final authorizations are valid for ±7 days: you must capture the exact amount authorized, and you can perform the capture at any time during the authorization period.
  • Sale authorizations are captured immediately

The values are PRE_AUTHORIZATION, FINAL_AUTHORIZATION, or SALE.

The optional property authorizationMode in the cardPaymentMethodSpecificInput object can be used to set the type of authorization you're sending. It applies to both API calls:

Final authorization and pre-authorization (either through the API or via configuration) allow you to choose when to perform a capture. However, to do that, you must submit the requiresApproval property. Just like the authorization type, you can also contact us to make this a fixed setting, so you don't need to send the requiresApproval in the request every time.

Here's an example of setting the property for the POST /v1/{merchantId}/payments API call:

POST PAYMENTS REQUEST

{
    "order": {
        "amountOfMoney": {
            "amount": 100,
            "currencyCode": "TRY"
        },
        "customer": {
            "merchantCustomerId": "1234567",
            "billingAddress": {
                "countryCode": "TR"
            }
        }
    },
    "cardPaymentMethodSpecificInput": {
        "paymentProductId": 189,
        "card": {
            "cvv": "000",
            "cardNumber": "9792052565200015",
            "expiryDate": "0127",
            "cardholderName": "Cevdet Deger"
        },
        "requiresApproval": true,
        "authorizationMode": "PRE_AUTHORIZATION"
    }
}

Contact us to make this setting permanent so that you don't need to send authorization type and requiresApproval in the request. If you don't set requiresApproval, regardless of which authorization type you use, it will behave as the Sale authorization.

After the customer finished the payment, GET /v1/{merchantId}/payments/{paymentId} will return a response:

Expand example code
GET PAYMENTS RESPONSE

{
   "createdPaymentOutput" : {
      "payment" : {
         "id" : "000009970210000008930000100001",
         "hostedCheckoutSpecificOutput" : {
            "hostedCheckoutId" : "0651fe3b-9d34-71ff-8643-1f65afc02123",
            "variant" : "124"
         },
         "paymentOutput" : {
            "amountOfMoney" : {
               "amount" : 100,
               "currencyCode" : "TRY"
            },
            "references" : {
               "paymentReference" : "0",
               "providerId" : "4700",
               "providerReference" : "200198375"
            },
            "paymentMethod" : "card",
            "cardPaymentMethodSpecificOutput" : {
               "paymentProductId" : 189,
               "authorisationCode" : "P02478",
               "fraudResults" : {
                  "fraudServiceResult" : "no-advice",
                  "avsResult" : "0",
                  "cvvResult" : "0"
               },
               "card" : {
                  "cardNumber" : "************0015",
                  "cardholderName" : "Cevdet Deger",
                  "expiryDate" : "0127"
               }
            }
         },
         "status" : "PENDING_APPROVAL",
         "statusOutput" : {
            "isCancellable" : true,
            "isRetriable" : false,
            "statusCategory" : "PENDING_MERCHANT",
            "statusCode" : 680,
            "statusCodeChangeDateTime" : "20231006123902",
            "isAuthorized" : true,
            "isRefundable" : false
         }
      },
      "paymentCreationReferences" : {
         "additionalReference" : "00000997021000000893",
         "externalReference" : "000009970210000008930000100001"
      },
      "paymentStatusCategory" : "SUCCESSFUL"
   },
   "status" : "PAYMENT_CREATED"
}

As seen above, the status will be changed to PENDING_APPROVAL (and not CAPTURE_REQUESTED, which is the usual status of a successful payment), indicating that it requires your approval to continue. You need to send the approval with the POST /v1/{merchantId}/payments/{paymentId}/approve API call to let us perform the capture. You may capture any amount equal to or lower than the authorized amount. After we receive your approval to capture, we'll proceed with the transaction, and the status will change to CAPTURE_REQUESTED.

Once the request is processed, POST /v1/{merchantId}/payments/{paymentId}/approve will return a response:

Expand request example
POST APPROVE REQUEST

{
   "payment" : {
      "id" : "000009970210000008900000100001",
      "paymentOutput" : {
         "amountOfMoney" : {
            "amount" : 100,
            "currencyCode" : "TRY"
         },
         "references" : {
            "paymentReference" : "0",
            "providerId" : "4700",
            "providerReference" : "200198351"
         },
         "paymentMethod" : "card",
         "cardPaymentMethodSpecificOutput" : {
            "paymentProductId" : 189,
            "authorisationCode" : "P44066",
            "fraudResults" : {
               "fraudServiceResult" : "no-advice",
               "avsResult" : "0",
               "cvvResult" : "0"
            },
            "card" : {
               "cardNumber" : "************0015",
               "cardholderName" : "Cevdet Deger",
               "expiryDate" : "0127"
            }
         }
      },
      "status" : "CAPTURE_REQUESTED",
      "statusOutput" : {
         "isCancellable" : true,
         "isRetriable" : false,
         "statusCategory" : "PENDING_CONNECT_OR_3RD_PARTY",
         "statusCode" : 800,
         "statusCodeChangeDateTime" : "20231006123230",
         "isAuthorized" : true,
         "isRefundable" : false
      }
   }
}

After the capture is processed, GET /v1/{merchantId}/payments/{paymentId} will return a response:

Expand response example
GET PAYMENTS RESPONSE

{
   "id" : "000009970210000008900000100001",
   "paymentOutput" : {
      "amountOfMoney" : {
         "amount" : 100,
         "currencyCode" : "TRY"
      },
      "references" : {
         "paymentReference" : "0",
         "providerId" : "4700",
         "providerReference" : "200198351"
      },
      "paymentMethod" : "card",
      "cardPaymentMethodSpecificOutput" : {
         "paymentProductId" : 189,
         "authorisationCode" : "P44066",
         "fraudResults" : {
            "fraudServiceResult" : "no-advice",
            "avsResult" : "0",
            "cvvResult" : "0"
         },
         "card" : {
            "cardNumber" : "************0015",
            "cardholderName" : "Cevdet Deger",
            "expiryDate" : "0127"
         }
      }
   },
   "status" : "CAPTURE_REQUESTED",
   "statusOutput" : {
      "isCancellable" : true,
      "isRetriable" : false,
      "statusCategory" : "PENDING_CONNECT_OR_3RD_PARTY",
      "statusCode" : 800,
      "statusCodeChangeDateTime" : "20231006123230",
      "isAuthorized" : true,
      "isRefundable" : false
   }
}

Refunds and cancellations

If you wish to cancel a payment, you have two opportunities to do so: before the capture and after the capture. Depending on the situation, you need to send a separate API call.

API call Conditions
Before capture POST/v1/{merchantId}/payments/{paymentId}/cancel Only when the status is PENDING_APPROVAL and statusOutput.isCancellable is true
After capture POST /v1/{merchantId}/payments/{paymentId}/refund Only when the status is CAPTURED. You can refund any amount equal or lower than the captured amount, and may do this until the total captured amount has been refunded.

A basic refund payload only requires the amountOfMoney object specifying the amount and currencyCode:


{
    "amountOfMoney": {
        "currencyCode": "TRY",
        "amount": 100
    }
}

If you'd like to see the details of your refund, use the GET /v1/{merchantId}/refunds/{refundId} API call:

GET REFUNDS REQUEST

{
   "id" : "00000997021000000896000-100001",
   "refundOutput" : {
      "amountOfMoney" : {
         "amount" : 100,
         "currencyCode" : "TRY"
      },
      "references" : {
         "paymentReference" : "0"
      },
      "paymentMethod" : "card",
      "cardRefundMethodSpecificOutput" : {
         "refundProductId" : 189
      }
   },
   "status" : "PENDING_APPROVAL",
   "statusOutput" : {
      "isCancellable" : true,
      "statusCategory" : "PENDING_MERCHANT",
      "statusCode" : 600,
      "statusCodeChangeDateTime" : "20231009213433"
   }
}
Next Process flows