Getting Token / Deleting Cards

Scenario

Consumers can save cards during checkout. If they want to remove cards saved, merchants can call this API to delete a saved card.

API URLs

  • Stage: https://ecpg-stage.ecpay.com.tw/Merchant/GetTokenbyUser
  • Production: https://ecpg.ecpay.com.tw/Merchant/GetTokenbyUser

Message format

  • Content Type:application/json
  • HTTP Method:POST

Request (Json format)

MerchantID String(10)
Required

For platform merchants, the value please populate with the Platform merchant’s MerchantID.

RqHeader Object
Required

Request header

Timestamp Number
Required

Unix timestamp

❗ Special note:

  • ECPay will verify the timestamp.If ECPay receives the request is more 10 minutes late than the timestamp, the transaction will be failed.
  • Merchants are suggested to synchronize the time of a computer on client- or server-side to another server or nearest reference time source.
  • For more details can be seen here; another online tool can be found here.

Data String
Required

Payload of JSON that has been encrypted.

Request Example (Json format)

				
					{
    "MerchantID": "3002607",
    "RqHeader": {
        "Timestamp": 1234567890
    },
    "Data": "enter your data"
}
				
			

Message payload of Data (Json format)

❗ Special note: Please urlencode the JSON string firstly and then do AES encryption.

PlatformID String(10)
 

Platform ID

  • This is used by platform merchants and will be provided by ECPay.
  • For platform merchants, please populate with [MerchantID].
  • For general merchants, please set as null.

MerchantID String(10)
Required

ConsumerInfo Object
Required

Consumer information

MerchantMemberID String(60)
Required

Consumer’s ID (as a member in merchant’s system)

Email String(30)

Credit card holder’s email

Phone String(60)

Credit card holder’s phone number

Name String(50)

Credit card holder’s name

CountryCode String(3)

Country codes. A 3-digit contry code of the credit card holder’s bill address, which should follow ISO 3166.

Address String(50)

Credit card holder’s bill address

CustomField String(200)
 

A parameter for merchant to place customized value.

Data Example:(Json format)

				
					{
    "MerchantID": "3002607",
    "ConsumerInfo": {
        "MerchantMemberID": "test123456",
        "Email": "customer@email.com",
        "Phone": "0912345678",
        "Name": "Test",
        "CountryCode": "158"
    }
} 

				
			

Response (Json format)

MerchantID String(10)

Merchant ID

RpHeader Object

Timestamp Number
 

Unix timestamp

TransCode Int
 

Response codes to indicate whether the payload is successfully accepted.

  • 1: Payload (i.e. MerchantID, RqHeader, and Data) is successfully accepted by ECPay.
  • Others: failed.

TransMsg String(200)

Response message to indicate whether the payload is successfully accepted.

Data String

Payload of JSON that has been encrypted.

Response Example (Json format)

				
					{
    "MerchantID": "3002607",
    "RpHeader": {
        "Timestamp": 1234564848
    },
    "TransCode": 1,
    "TransMsg": "Success",
    "Data": "…"
}
				
			

Message payload of Data (Json format)

RtnCode Int

Response codes to indicate whether the API is successfully executed or not.

  • 1: API is successfully executed.
  • Others: failed.
  • For more details please see error codes.

RtnMsg String(200)

Response messages.

PlatformID String(10)

Platform merchant’s MerchantID.

MerchantID String(10)

Token String(64)

Each checkout request to ECPay requires a token, which is used to validate merchant’s identity. The lifespan is 30 minutes.

TokenExpireDate String(20)

Token’s expiry date. Format: yyyy/MM/dd HH:mm:ss

Data Example(Json format)

				
					{
    "RtnCode": 1,
    "RtnMsg": "Success",
    "PlatformID": "1234567890",
    "MerchantID": "1234567890",
    "Token": "m12dae4846446sq",
    "TokenExpireDate": "2020/09/18 15:39:10"
}
				
			

Copyright © Green World FinTech Service Co., Ltd. All rights reserved.

Green World