Scenarios
- In the event of a return of sales, exchange of goods or allowance after the invoice has been issued, Merchant(Business Entity) will issue the allowance.Merchant may use this function to send the canceled allowance parameters to Green World due to an error in the creation of the contents and after Merchant has reached an agreement with the Counterparty to the transaction. Green World will temporarily store the canceled allowance data.
- Green World uploads the canceled allowance message to The E-Invoice Platform of Ministry of Finance on the next day and notifies the Counterparty (Business Entity) that the e-invoice discount is invalidated (not cancel issuing) according to the Send E-invoices Status Notices API setting.
API URLs:
- Stage: https://einvoice-stage.ecpay.com.tw/B2BInvoice/CancelAllowance
- Production: https://einvoice.ecpay.com.tw/B2BInvoice/CancelAllowance
HTTPS format
- Content Type :application/json
- HTTP Method :POST
Request by Merchant (Json format)
PlatformID String(10)
- Platform merchant ID
- This parameter is provided by ECPAY to the platform vendor for project cooperation, please bring in the MerchantID bound with the platform vendor.
- Please leave empty for general vendor.
- When the platform vendor uses the MerchantID field, it can only bring in the MerchantID that has been bound as a sub-store, otherwise it will cause a failure.
MerchantID String(10)
Required
RqHeader
Object
Required
Request header
Timestamp Number
Required
- Please convert the transmission time to a timestamp (GMT+8).
- ECPay will use this parameter to convert the current time to Unix TimeStamp to verify the time interval of this connection.
Special Notes:
- If ECPay receives the API call is more 10 minutes late than the timestamp sent by merchants, this request will be failed. Reference information is as follows:http://www.epochconverter.com/。
- Merchants are suggested to frequently synchronize the time zone of server to another server of the nearest time zone.
Data String
Required
- Message payload
- This is the encrypted data in JSON format.
AES Encryption Description
Example
{
"MerchantID": "2000132",
"RqHeader": {
"Timestamp": 1525168923
},
"Data": "..."
}
Message payload of Data(Json format) : please urlencode the JSON string firstly and then do AES encryption
MerchantID String(10)
Required
AllowanceNo String(16)
Required
Green World Allowance Number
Reason String(20)
Required
Cancel Reason
Remark String(200)
Example
{
"MerchantID": "2000132",
"AllowanceNo": "1909241702402030",
"Reason": "Cancel_Allowance_Reason",
"Remark": "Cancel_Allowance_Reamrk"
}
Response format
- Content Type :application/json
- HTTP Method :POST
Response by ECPay (Json format)
PlatformID String(10)
MerchantID String(10)
Required
RpHeader
Object
Response header
Timestamp Number
Unix timestamp(GMT+8)
TransCode Int
- Response code to indicate whether the payload is successfully accepted
- Possible values:
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
- Message payload
- Responde relevant data, this is the encrypted JSON format data。
AES Encryption Description
Example
{
"MerchantID": "2000132",
"RpHeader": {
"Timestamp": 1525169058
},
"TransCode": 1,
"TransMsg": "",
"Data": "..."
}
Message payload of Data(Json format) : please do AES decryption to the Data firstly and then do urldecode.
RtnCode Int
- Return codes to indicate whether the API is successfully executed or not.
- 1 is success, others are failure.
RtnMsg String(200)
Return messages to indicate whether the API is successfully executed or not.
Example
{
"RtnCode": 1,
"RtnMsg": "Success"
}
Special Notes :
- If the e-invoice has been allowanced, it cannot be canceled or invalidated directly. Please confirm that all of its allowance slips have been canceled before.