Pay-in (v2)

Description

This endpoint will help merchants to start a pay-in transaction. And v2 is recommended to integrate this endpoint instead of v1 .

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/v2/pwpp

Parameters

Name
Type
Mandatory
Description

Content-Type

string

application/json

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 bank: 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 bank 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)

no

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

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

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 Approved

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

eci

string

no

ECI(The Enrollment Check Indicator): e.g. 05

cavv

string

no

CAVV(Cardholder Authentication Verification Value): e.g. AAABB0011223344

dsTranId

string

no

DSTranId(Directory Server Transaction ID): e.g. 0123456789ABCDEF

idCardURL

string

no

URL of KYC information, e.g. https://imagelink.com/image123456.jpg

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 bank if request parameter storeCc=1

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/v2/pwpp' \
-H 'Content-Type: application/json' \
-d `{
	"merchantId": 206051,
	"userId": "user-206051",
	"amount": "100.11",
	"createTime": "1664353148000",
	"currency": "USD",
	"ip": "45.82.243.161",
	"merchantTradeNo": "NO202305261652",
	"firstName": "Joe",
	"lastName": "Doe",
	"email": "[email protected]",
	"iddCode": "971",
	"mobile": "971524028321",
	"addressLine": "LAMTARA 9 909",
	"country": "ES",
	"city": "Dubai",
	"document": "88975525015",
	"cardNumber": "4242424242424242",
	"cvv": "123",
	"expDate": "12/29",
	"zip": "76167",
	"payChannel": "payChannel1",
	"callBackURL": "https://merchant.service.com/callback",
	"successURL": "https://merchant.service.com/succed",
	"failURL": "https://merchant.service.com/fail",
	"retURL": "https://merchant.service.com/return",
	"clientHTTPAccept": "text%2Fhtml%2Capplication%2Fxhtml%2Bxml%2Capplication%2Fxml%3Bq%3D0.9%2Cimage%2Favif%2Cimage%2Fwebp%2Cimage%2Fapng%2C*%2F*%3Bq%3D0.8%2Capplication%2Fsigned-exchange%3Bv%3Db3%3Bq%3D0.7",
	"clientHTTPUserAgent": "Mozilla%2F5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2010_15_7)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F112.0.0.0%20Safari%2F537.36",
	"sign": "b02c7d2fd87e1b00dd7efe7069"
}`
  • Response

Successful response example, transaction status is PROCESSING.

{
  "code": 0,
  "msg": "success",
  "data": {
    "orderId": "2209141130105863014",
    "pageData": "",
    "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": "https://static.cpayapi.com/pages/payment-processing.html?orderId=2209141130105863014",
    "ccStorageID": "",
    "orderStatus": 11
  },
  "traceid": "221117082056X6478814"
}

Last updated