\n\t\t\t\t\t\t\tThe following guide explains the required steps in order to receive payments using Alipay through the Openpay API.\n
Flow<\/h3>\n
<\/center>Steps:\n\n \t
The customer requests to pay through Alipay<\/li>\n \t
The merchant starts a new Alipay transaction using the Openpay API<\/li>\n \t
The merchant redirects the customer to the URL returned by Openpay<\/li>\n \t
The customer pays using his Alipay account<\/li>\n \t
The transaction is completed in Openpay<\/li>\n \t
The merchant is notified of a completed payment\n\n \t
The customer is redirected back to the merchant website, and the merchant verifies the transaction status<\/li>\n \t
The merchant receives a notification from Openpay as an alternate confirmation method<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n The merchant must implement steps 1 through 3 to start the transaction, and step 6 to receive the completed payment notification.\n
Starting a transaction (Steps 1 through 3)<\/h2>\nIn order to start an Alipay transaction you must specify the transaction method as alipay. Additionaly, you must specify the URL to where the customer will be redirected to once the payment process is completed.\n
\n\n
<?php <\/span>\n $openpay<\/span> =<\/span> Openpay<\/span>::<\/span>getInstance<\/span>(<\/span>'mzdtln0bmtms6o3kck8f'<\/span>,<\/span> 'sk_e568c42a6c384b7ab02cd47d2e407cab'<\/span>);<\/span>\n $chargeData<\/span> =<\/span> array<\/span><\/strong>(<\/span>\n 'method'<\/span> =><\/span> 'alipay'<\/span>,<\/span>\n 'amount'<\/span> =><\/span> 100.00<\/span>,<\/span>\n 'description'<\/span> =><\/span> 'Cargo mediante Alipay'<\/span>,<\/span>\n 'redirect_url'<\/span> =><\/span> 'https:\/\/www.example.com\/myUrl'<\/span>\n );<\/span>\n $charge<\/span> =<\/span> $openpay<\/span>-><\/span>charges<\/span>-><\/span>create<\/span>(<\/span>$chargeData<\/span>);<\/span> ?><\/span><\/code><\/pre>\n<\/figure>\n<\/div>\nIf the process is successful, Openpay will return a response with an URL to which your customer must be redirected to in order to complete their payment through Alipay.\n\nResponse:<\/strong>\n\n
Alipay payment (Steps 4 and 5)<\/h2>\nOnce the user arrives in the Alipay website, they can use the Alipay App to scan the given QR Code:\n\n
<\/center>Or, alternatively, the customer can login into their Alipay account and complete payment in the browser:\n\n
<\/center>\n
Payment confirmation (Step 6)<\/h2>\nOnce the transaction has been paid, Openpay will set the transaction status to completed. The customer will be redirected back to the merchant website and a notification will be sent to the merchant's configured webhooks.\n
Redirect confirmation (6a)<\/h3>\nUna vez que el usuario haya completado su pago en Alipay, ser\u00e1 redirigido a la URL que fue indicada al momento de crear el cargo, con el par\u00e1metro id agregado indicando la transacci\u00f3n que se ha completado.\n\nEjemplo:\n
https:\/\/www.example.com\/myUrl?id=trxxqosgmdsvt3hocoun\n<\/code><\/pre>\nThe merchant must then use this ID to retrieve the transaction status using the Openpay API, and confirm that the transaction status<\/code> <\/span>is completed<\/code><\/span>.\n\n\nNote:<\/span><\/strong> If the transaction status is not yet completed<\/code>, the transaction is still pending payment and could still be completed at a later date.<\/span><\/em>\n