Skip to main content

Payment with a predefined payment method

This is API V1, which is no longer maintained

For up-to-date documentation, see the latest version.

There is a possibility to present available payment methods directly on the store's website and to include the payment method selected by the customer in the request for payment.

Step 1: Retrieve available payment methods by making GET on payment methods request. Attach Api-Key header with the value of Api-Key available in the Merchant Panel.

If it is possible applePayEnabled optional parameter should be used to enhance payer experience to filter out Apple Pay method based on following Javascript code snippet (based on official Apple documentation here):

let applePayEnabled = window.ApplePaySession && window.ApplePaySession.canMakePayments();

This code needs to be executed in the browser.

Step 2: Handle the returned response:

[
{
"type": "PBL",
"paymentMethods": [
{
"id": 1000,
"name": "mTransfer",
"description": "Zapłać przez mTransfer",
"image": "https://static.sandbox.paynow.pl/payment-method-icons/1000.png",
"status": "ENABLED",
"authorizationType": "REDIRECT"
}
]
}
]

The response contains a id of payment method which will be used in the payment request.

Step 3: Prepare a payment request message containing paymentMethodId from previous step corresponding to the payment method chosen by the client.

{
"amount": 45671,
"externalId": "234567898654",
"paymentMethodId": 1000,
"description": "Test transaction",
"buyer": {
"email": "jan.kowalski@melements.pl"
}
}

Step 4: The next steps are the same as described in the Make a payment section.