Re-Authorizing and Canceling Subscription Order

Scenario

This API provides merchants to perform specific actions to subscription orders, including:

  • ReAuth: if the authorization of the latest subscription order failed, merchant can call this API (Action=ReAuth) to re-authorize the payment.
  • Cancel:to deactivate this and further recurring payments.

API URLs

  • Stage: https://ecpayment-stage.ecpay.com.tw/1.0.0/Cashier/CreditCardPeriodAction
  • Production: https://ecpayment.ecpay.com.tw/1.0.0/Cashier/CreditCardPeriodAction

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 merchant’s MerchantID.

MerchantID String(10)
Required

MerchantTradeNo String(20)
Required

Merchant’s order ID

Action String(20)
Required

The action to the order. Perform actions to order, either to ReAuth or to Cancel the payment. Possible values:

  • ReAuth
  • Cancel

❗ Special notes:

  1. This API is only restricted to if the latest authorization failed. For example, if the second time authorization failed, but the third time was success, in this case merchants cannot call this API to re-authorize the second time authorization.
  2. After Cancel (Action=Cancel) a subscription payment, this payment cannot be re-active. Merchants can only create another new supscription order.

Data Example:(Json format)

				
					{
    "MerchantID": "3002607",
    "PlatformID": "2000132",
    "MerchantTradeNo": "123486456",
    "Action": "ReAuth"
} 

				
			

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)

MerchantID String(10)

MerchantTradeNo String(20)

Merchant’s order ID

Data Example(Json format)

				
					{
    "RtnCode": 1,
    "RtnMsg": "Success",
    "PlatformID": "1234567890",
    "MerchantID": "1234567890",
    "MerchantTradeNo": "123456789014"
}
				
			

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

Green World