JS & Apple Pay

Use this library to integrate Paylink payments into your app and grow your business with Paylink APIs to proceed with easy Payment and generate customer invoices.

Step 1: SDK Initialization

Please ensure the SDK Initialization steps are completed before proceeding with the following steps. This is crucial for the proper functioning of the payment process.


Step 2: Opening ApplePay Payment Window

Call the openApplePay function to open the ApplePay payment window. It takes the generated "token" in the server-side and the "order" object.

payment.openApplePay(token, order, successCallback);

The openApplePay function takes the following parameters:

Parameters nameDescriptionvalue type
tokenThe token is programmatically generated on the server side (Step 1).string
orderThe order object for the new Invoice.Order object type
successCallbackthe callback function that will be called when the popup screen opens.JavaScript function

Step 3: Handling Payment Process Response

Finally, from the server side, programmatically process the payment response sent by Paylink after the payment process finishes. This step is crucial for security reasons; carefully follow Get Invoice to handle the payment result from Paylink.


❗️

Important

  • Merchant's application must call GetInvoice (here) endpoint immediately after the payment from the server side. First, check the integrity of the price by checking the payment status "orderStatus" and the amount paid "amount".
  • Then proceed with the order processing of the client as paid or not. Otherwise, avoid using the endpoint GetInvoice and checking the amount and status will jeopardize the security of the payment.

Sample Code

You can download a sample of the code written in PHP from here.