Web SDK Integration for Saved Cards Flow
note
- Both SandboxandProductionmode integration can be managed via same APIs and same account on PortOne platform.
- Please refer following instructions to use appropriate environmentflags while integration.
Embed Script#
Embed following JS snippet in your Checkout UI
New setup details#
For integration embed the following scripts in your Checkout UI code.
tip
Refer Integration Sheet to check the extensive list of available Payment Channels & Payment Methods for Integration in your country.
Environment Flag#
Pass the environment flag in above payload. Environment is the mandatory field, by default the value of environment is sandbox while initiating payment.
Production
Sandbox
Initialize the Web SDK#
Use following JS code snippet to initialize the web sdk
Generate OTP#
Use following JS code snippet to generate the otp in payment service using the end user's phone number. An otp will be send on the provided phone number
Get Saved Cards#
Use following JS code snippet to fetch the saved cards in payment service using the end user's phone number and the otp received by the end user on the phone number for authorization.
A list of saved cards will be received in response if the cards are saved for this user in earlier payment transactions.
Payment Service#
Use following JS code snippet to initiate the payment using the respective supported payment channels (e.g. MOMO, ZaloPay, Mastercard, etc).
To generate the signature hash, refer Generate Signature Hash link.
Detailed script for payment service (including optional fields).
Parameter list#
| Parameter | Datatype | Obligatory/Optional | Description | 
|---|---|---|---|
| key | string | Obligatory | The unique PortOne key for merchant | 
| pmt_channel | string | Obligatory | The Payment Channel Key listed in PortOne docs | 
| pmt_method | string | Obligatory | The Payment Method Key listed in PortOne docs | 
| environment | string | Obligatory | Environment of the payment | 
| description | string | Obligatory | Order description set in PSP order creation | 
| merchant_order_id | string | Obligatory | The unique merchant order reference generated by the merchant | 
| amount | double | Obligatory | The amount of transaction, can be a floating-point number | 
| currency | string | Obligatory | Currency for transaction | 
| billing_details | object | Optional | The JSON object for billing details | 
| shipping_details | object | Optional | The JSON object for shipping details | 
| order_details | array of objects | Optional | Order Details like quantity, id, name, price are Obligatory, while image is Optional | 
| token_params | object | Obligatory | Saved Card token details like token, expiry_year, expiry_month to initaite payment using saved cards | 
| success_url | string | Obligatory | Redirection url for success | 
| failure_url | string | Obligatory | Redirection url for failure | 
| signature_hash | string | Obligatory | Signature calculated using this link |