Issuing Operations / Issuing Allowance / Issuing general allowance

Application Scenarios

In general, ECPay provides two methods to issue the allowance when a sales return happens. The first one is general allowance, which requires merchants or sellers to get the agreement from the customer firstly (not by using ECPay’s system) and then to send API request to ECPay to issue an allowance. The other one is sending API request to ECPay and ECPay will send an e-mail notification to the customer to get his/her agreement. In the email notification there is a link and once the customer clicks the link, an allowance will be issued instantly.

❗ Special Notes:Per regulations from the Ministry of Finance, after transmitting paper allowance information via API, it is mandatory to obtain confirmation of the allowance slip details from the buyer. Consequently, you must mail the physical allowance slip to the consumer for their signature and then retain it in your own records, in preparation for sporadic audits by the supervisory authorities.

API URLs:

  • Stage: https://einvoice-stage.ecpay.com.tw/B2CInvoice/Allowance
  • Production: https://einvoice.ecpay.com.tw/B2CInvoice/Allowance

HTTPS format

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

Request by Merchant (Json format)

PlatformID String(10)

  • This parameter is specifically designed for platform vendors collaborating with ECPay. It can only be utilized after applying for and activating the service.
  • If you are a general vendor, please leave the PlatformID empty.
  • When using this parameter, the MerchantID must be filled in with the specific store code bound to your PlatformID to prevent operation failures.
  • Please note that only the MerchantID of a bound sub-merchant can be used to avoid operational failures. For binding operations, please contact your business representative.

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

InvoiceNo String(30)
Required

  • E-invoice number
  • Fix length: 10

InvoiceDate String(10)
Required

  • Date of e-invoice created
  • The format: yyyy-MM-dd

CustomerName String(60)

  • The name of the customer you are invoicing.
  • Only numbers and Chinese or English characters are acceptable.

NotifyMail String(100)

  • Customer’s mail address to receive the notification
  • Required and should have value if AllowanceNotify : E (i.e. to notify the constomer by email.)
    2. Only valid email formats (i.e. aa@bb.cc) are accepted.
    3. NotifyMail can be more than one email address and using the to the semicolon (;) to separate different email address. For example: aaa@ecpay.com.tw; bbb@ecpay.com.tw

NotifyPhone String(20)

  • Customer’s mobile number to receive the notification
  • Required if AllowanceNotify: S (receiving notifications by SMS).
  • Only numbers are acceptable.

AllowanceAmount Int
Required

Total amount of this allowance (tax included)

❗ Special Notes:
   The total amount of the allowance should be greater than $0
1. If the invoice has not been allowanced, it should be less than or equal to the total amount of the original invoice
2. If this invoice has been allowanced, it should be less than or equal to the remaining amount of allowance

Items Array[Object]

ItemSeq Int

Required

Item Sequence Number

ItemName String(100)
Required

  • Item Name
  • Value is required; empty string is not accepted.

ItemCount Number
Required

  • Merchandise quantity
  • It could be up to 8 integers and 2 decimals after the decimal point.

ItemWord String(6)
Required

  • Merchandise units
  • For example, “個” in Chinese.

ItemPrice Number
Required

  • Merchandise price (tax-included)
  • It could be up to 8 integers and 7 decimals after the decimal point.
  • The value of ItemPrice is tax-excluded if vat:0 (tax-excluded).
  • The value of ItemPrice is tax-included if vat:1 (tax-included).

ItemTaxType String(1)

  • Merchandise tax category
  • 1: Should be taxed
    2: Tax rate is zero
    3: Duty Free

❗ Special notes : 

  1. Preset is an empty string, when the tax category [TaxType] = 9, this parameter cannot be null.
  2. When [TaxType]=9, [ItemTaxType] will need to discern the tax rate of each merchandise, amongst them should be at least 1 item that is 1(To be taxed) and another as 2(Duty Free) or 3(Tax rate is zero). Implying the combined tax rate E-Invoice can only be: 1|3(To be taxed and Duty Free) or 1|2(To be taxed and tax rate is zero).

ItemAmount Number
Required

  • Merchandise total amount (tax-included).
  • This parameter supports up to 8-digit integer and 7-digit decimal.
  • The value of the amount should be tax included.

❗ Special notes :

Integer only because of the law and regulations of MOF in Taiwan.

Example

				
					{
    "MerchantID": "2000132",
    "InvoiceNo": "UV11100013",
    "InvoiceDate": "2019-09-17",
    "AllowanceNotify": "E",
    "CustomerName": "%e7%b6%a0%e7%95%8c%e7%a7%91%e6%8a%80%e8%82%a1%e4%bb%bd%e6%9c%89%e9%99%90%e5%85%ac%e5%8f%b8",      "NotifyMail": "test@ecpay.com.tw", 
    "NotifyPhone": "0912345678",
    "AllowanceAmount": 50, 
    "Items": [{ 
             "ItemSeq": 1,
             "ItemName": "item01", 
             "ItemCount": 1, 
             "ItemWord": "件",
             "ItemPrice": 50, 
             "ItemTaxType": "2",
             "ItemAmount": 50 
             }] 
    }
				
			

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.
  • Possible values:
    1: API is successfully executed.
    Others: failed.

RtnMsg String(200)

Return messages to indicate whether the API is successfully executed or not.

IA_Allow_No String(16)

  • Allowance order number
  • If issing allowance success: the allowance number will be responded.
  • If not, a null vlaue will be responded.

IA_Invoice_No String(10)

  • E-Invoice number
  • If the issuance is successfully completed then the original set of E-Invoice number will be sent in return;
  • If the issuance failed then a blank value will be sent in response.

IA_Date String(20)

  • Allowance time
  • Allowance order issuance time will be returned upon issuance success;
    Return format is “yyyy-MM-dd HH:mm:ss”;
  • If the issuance failed then a null value will be sent in response.

IA_Remain_Allowance_Amt Int

  • Remaining amount of allowance
  • Remaining amount of allowance will be returned upon issuance success;
  • If the issuance failed then a blank value will be sent in response.

Example

				
					{
    "IA_Allow_No": "2019091717363987",
    "IA_Invoice_No": "UV11100013",
    "IA_Date": "2019-09-17 17:36:18",
    "IA_Remain_Allowance_Amt": 50,
     "RtnCode": 1,
     "RtnMsg": "success"
}
				
			

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

Green World