Pay-in (v1)

Description

This endpoint will help merchants to start a pay-in transaction. v1 will be deprecated in future and v2 is recommended to integrate.

Note: The difference between v1 and v2:

  • v1: Content-Type: application/x-www-form-urlencoded

  • v2: Content-Type: application/json

Endpoint

  • REST API: POST https://live.cpayapi.com/openapi/v1/pwpp

Parameters

Name
Type
Mandatory
Description

Content-Type

string

application/x-www-form-urlencoded

Body

Name
Type
Mandatory
Description

merchantId

int64

yes

unique id generated by us

merchantTradeNo

string(64)

yes

unique order id generated by merchant

userId

string(64)

yes

unique user id generated by merchant

storeCc

string(2)

no

whether the card will be stored in the acquirer: 0 = don't store it (default) 1 = store it if storeCc=1, merchants will get parameter ccStorageID in response, and should store it

ccStorageID

string(64)

no

the acquirer can complete a payment with this parameter instead of card information

firstName

string(20)

yes

first name on credit card

lastName

string(30)

yes

last name on credit card

email

string(64)

yes

email of billing, e.g. [email protected]

iddCode

string(8)

yes

country calling code of billing, e.g. 852(Hong Kong), see details here

mobile

string(64)

yes

mobile of billing, e.g. 712345678, don't add the iddCode as a prefix

addressLine

string(64)

yes

address of billing

country

string(8)

yes

country of billing

city

string(64)

yes

city of billing

zip

string(16)

yes

postcode of address

cardNumber

string(64)

yes

credit card or debit card number

cvv

string(8)

yes

cvv code, e.g. 135

expDate

string(16)

yes

expiration of the card, month/year, e.g. 12/27 means the card will be expired at Dec. 2027

ip

string(64)

yes

client IPV4

document

string(64)

no

identification number of users

currency

string(8)

yes

currency code, e.g. USD. all supported currencies

amount

string(32)

yes

amount to be paid, the precision is 2 decimal places, higher precision will be rounded, e.g. 19.011 -> 19.01, 1.528 -> 1.53

products

string(512)

no

product information, a JSON string, e.g. [{"name":"iphone 11","price":"5300.00","num":"2","currency":"CNY"},{"name":"macBook","price":"1234.00","num":"1","currency":"USD"}]

clientHTTPAccept

string(512)

no

field Accept of user's browser, it's mandatory if merchants use payChannel2, e.g. text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7

clientHTTPUserAgent

string(512)

no

field UserAgent of user's browser, it's mandatory if merchants use payChannel2, e.g. Mozilla/5.0 (iPhone; CPU iPhone OS 11_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1

callBackURL

string(256)

no

merchants will received notifications by this URL when payment Approved or Declined

successURL

string(256)

no

redirect to this URL when payment COMPLETED

failURL

string(256)

no

redirect to this URL when payment Declined

retURL

string(256)

no

after finishing the 3DS flow, the acquirer will redirect users to this URL

payChannel

string(16)

no

all payment channels see here

createTime

string(20)

no

order created time (ms) in merchant side

txMode

string(16)

no

  • h2h (default)

  • redirection

sign

string(128)

yes

Response

Name
Type
Description

code

int64

msg

string

description of code

traceid

string

unique request id generated by us

data.orderId

string

unique order id generated by us

data.orderStatus

int

data.pageData

string

deprecated, original HTML source, which received from the acquirer.

data.htmlSource

string

original HTML source, which received from the acquirer. you can render it by yourself.

data.redirectURL

string

the URL should be redirected to users by merchant if not empty

data.ccStorageID

string

unique credit card id generated by the acquirer if merchants pass storeCc=1 parameter

data.remark

string

if orderStatus=15(Declined), the reason will be set to this field.

Example

  • Request

curl -X POST 'https://live.cpayapi.com/openapi/v1/pwpp' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'merchantId=206051' \
-d 'userId=user-206051' \
-d 'amount=100.11' \
-d 'createTime=1664353148000' \
-d 'currency=USD' \
-d 'ip=45.82.243.161' \
-d 'merchantTradeNo=NO202305261652' \
-d 'firstName=Joe' \
-d 'lastName=Doe' \
-d '[email protected]' \
-d 'iddCode=971' \
-d 'mobile=971524028321' \
-d 'addressLine=LAMTARA 9 909' \
-d 'country=ES' \
-d 'city=Dubai' \
-d 'document=88975525015' \
-d 'cardNumber=4242424242424242' \
-d 'cvv=123' \
-d 'expDate=12/29' \
-d 'zip=76167' \
-d 'payChannel=payChannel1' \
-d 'callBackURL=https://merchant.service.com/callback' \
-d 'successURL=https://merchant.service.com/succed' \
-d 'failURL=https://merchant.service.com/fail' \
-d 'retURL=https://merchant.service.com/return' \
-d 'sign=b02c7d2fd87e1b00dd7efe7069'

  • Response

Successful response example, return original HTML data.

{
  "code": 0,
  "msg": "success",
  "data": {
    "orderId": "2209141130105863014",
    "pageData": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<title>Link4Pay 3Dsecure</title>\n<style>\n body {\n margin: 0;\n }\n iframe.ifrale3ds {\n display: block;\n border: none;\n height: 100vh;\n width: 100vw;\n overflow:hidden;\n }\n    </style>\n</head>\n<body>\n<input type=\"hidden\" name=\"carddatajobID\" id=\"carddatajobID\" value=\"3c72fa0a-76ad-41c0-8aa7-c2d9843a6ec5\" />\n<iframe class=\"ifrale3ds\" title=\"Iframe 3DS\" name=\"challengeIframe\" id=\"challengeIframe\" sandbox=\"allow-same-origin allow-top-navigation allow-forms allow-scripts\"></iframe>\n<form id=\"challengeForm\" method=\"post\" target=\"challengeIframe\" action=\"https://bpcepaymentservices-3ds-vdm.wlp-acs.com/acs-challenge-browser-service/challenge/challengeRequest/browserBase/d3f1e50a-85ff-4982-8afe-d448",
    "htmlSource": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<title>Link4Pay 3Dsecure</title>\n<style>\n body {\n margin: 0;\n }\n iframe.ifrale3ds {\n display: block;\n border: none;\n height: 100vh;\n width: 100vw;\n overflow:hidden;\n }\n    </style>\n</head>\n<body>\n<input type=\"hidden\" name=\"carddatajobID\" id=\"carddatajobID\" value=\"3c72fa0a-76ad-c2d9843a6ec5\" />\n<iframe class=\"ifrale3ds\" title=\"Iframe 3DS\" name=\"challengeIframe\" id=\"challengeIframe\" sandbox=\"allow-same-origin allow-top-navigation allow-forms allow-scripts\"></iframe>\n<form id=\"challengeForm\" method=\"post\" target=\"challengeIframe\" action=\"https://bpcepaymentservices-3ds-vdm.wlp-acs.com/acs-challenge-browser-service/challenge/challengeRequest/browserBase/d3f1e50a-8afe-d448",    
    "redirectURL": "",
    "ccStorageID": "",
    "remark": "",
    "orderStatus": 11
  },
  "traceid": "221117082056X6478814"
}

Last updated