Issuing Operations / Issuing E-invoice / Delayed issuing

Application Scenarios

(2) Delayed issuing
The merchant can use this function to transmit the E-Invoice issuance parameter to the Green World system in advance, where Green World will temporarily store the E-Invoice data until the delayed E-Invoice issuance time arrives. The system will automatically issue the E-Invoice and upload to the Ministry of Finance, simultaneously informing the customer that the E-Invoice has been issued.

API URLs:

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

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 more than 10 minutes after the timestamp sent by merchants, this request will fail. Reference information is as follows:http://www.epochconverter.com/
  • Merchants are advised to frequently synchronize their server’s time to the nearest time zone server.

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 first and then do AES encryption

MerchantID String(10)
Required

RelateNumber String(30)
Required

  • Unique ID of the e-invoice which is defined by the merchant itself.

ChannelPartner String(1)

 

1:Shopee
The rest of the values are ignored.

CustomerID String(20)

This parameter enables merchants who have a member system to input the ID of individual consumer (customer).

❗ Special notes : Only English letters, numbers, and underscore are acceptable. For example, abc_123

ProductServiceId String(10)

  • The ID of Product-Service Types
  • This parameter must consist of English letters (A-Z, a-z) and numbers (0-9), and its length must be between 1 and 10 characters.
  • This parameter will only be processed when the internal backend switch is enabled; otherwise, this parameter will be ignored. To enable this feature, please contact your account representative.

CustomerIdentifier String(8)

CustomerName String(60)

  • The name of the customer you are invoicing.
  • This will be required if Print=1.
    (1). If it is required, about the format, only numbers and Chinese or English characters are acceptable.
    (2). If it is required, CustomerIdentifier should be required as well. In this case, the CustomerIdentifier should be populated with the name of the customer’s company.

CustomerAddr String(100)

  • The address of the customer to receive the e-invoice
  • This will be required if Print=1.

CustomerPhone String(20)

  • The phone number of the customer you are invoicing.
  • (1). This is optional if CustomerEmail is sent (i.e. either CustomerPhone or CustomerEmail is required.)
    (2). If it is sent, only numbers are acceptable.

CustomerEmail String(80)

  • The email of the customer you are invoicing.
  • (1). This is optional if CustomerPhone is sent (i.e. either CustomerPhone or CustomerEmail is required.)
    (2). If it is sent, only valid email format is acceptable (i.e. an email prefix and an email domain, both in acceptable formats. The prefix appears to the left of the @ symbol. The domain appears to the right of the @ symbol.)
    (3). Only one email address is acceptable, while more than one is not allowed.

❗ Special notes :

1. When testing ECPay’s API on Stage , please do not place your real email address in order to avoid personal data breach.
2. When testing ECPay’s API on Stage, ECPay’s API will respond success or failure only and the API will validate if the email address is valid or not. Once the e-invoice is created, the Stage will not support sending email notification feature, but the Production will.

ClearanceMark String(1)

  • A mark to indicate whether the goods is through the customs or not.
  • This is required if the [TaxType] is provided as 2 (no tax).
    Possible value:
    1: If the goods is NOT via the customs.
    2: Via the customs.

Print String(1)
Required

  • A mark to indicate whether this e-invoice is to be generated as PDF or not.
  • 0: Not to print
    1: To print

❗ Special notes : 

  1. If the donation note [Donation ]= “1” (Donation), please fill in 0.
  2. If the unified Business No. [CustomerIdentifier] has a value :
    2.a If the carrier type [CarrierType] be empty, please fill in 1.
    2.b If the carrier type [CarrierType]= “1” or “2”, please fill in 0.
    2.c If the carrier type [CarrierType]= “3”, please fill in 0 or 1.

❗ Special notes :
For KIOSK printing
(Please input the corresponding parameters as required, in addition to the request from our sales staff. )
1. To print the unannounced winning E-Invoice(ibon):
[Print]=1,[CarrierType]=””,[CustomerIdentifier]=””,[Donation]=0,
print only once (the E-Invoice cannot be reprinted in the future even if it wins)
2. To print the winning E-Invoice(iborn, FamiPort):
[Print]=0,[CarrierType]=1,[CustomerIdentifier]=””,[Donation]=0,print only once
3. If the remaining amount after allowance is NT $0, the E-Invoice can not be printed.

Donation String(1)
Required

  • A mark to indicate whether this e-invoice is to be donated to charity organizations or not.
  • 0 : Not donation
    1 : For donation

❗ Special notes :
If the unified Business No. [CustomerIdentifier] has a value, then Donation is 0 which means do not donate.

LoveCode String(7)

  • Donation code
  • If customer chooses to donate E-Invoice, then the Donation Code of the donated needs to be entered to this parameter.
    1. If the donation note [Donation ]= ‘1’ (Donation), then this parameter shall have value.
    2. Donation code is limited to numerical digits, a minimum of three and maximum of seven. Content is designated as “Character Format”, first digit can be 0.

❗ Special notes :
When using the LoveCode, please call Verifying the Existence of Love Code to check it first to avoid input errors.

Recommendation donation code
168001
OMG Charitable Foundation for Social Care
Setup up in 2009 with the goal of gathering the support of web users to deliver love and care to every corner of the society.
Our Foundation strives to: Support the schooling of students under the poverty line or that lack education resources, protection of strays and animals in general, support of the elderly and minority, emergency support, humanitarian aid, social charity events and ad support…and others.

CarrierType String(1)

  • The type of carrier to store this e-invoice
  • If the print parameter [Print]=1 (indicating printing is required), and carrier is also needed, then it can only carry 3 denoting E-Invoice cellphone carrier. If no carrier is needed, please pass in an empty string.
  • If it is a ECPay E-Invoice carrier, then please fill in 1
  • If it is the customer’s citizen digital certificate, then please fill in 2
  • If customer use E-Invoice cellphone carrier, please fill in 3.

❗ Special notes :

  1. When the printing note [Print]=1(print E-Invoice), please keep this parameter empty.
  2. If the printing note [Print]=0(Do not print E-Invoice) and the Unified Business No. [CustomerIdentifier] has value, this parameter cannot be empty
  3. Only E-Invoice with a Green World E-Invoice carrier ([CarrierType]=1) can be printed on ibon after winning.

CarrierNum String(64)

  • The number of the carrier to store this e-invoice.
  • When the carrier type [CarrierType]=””(no carrier), please empty the string, if the [CarrierType]=”1″(Green World E-Invoicecarrier), then please empty the string, the system will fill in the value automatically.
  • When the carrier type[CarrierType]=”2″(customer’s citizen digital certificate), then please fill in a fixed length of 16 and sequence format of 2 alphabet and 14 numerical digits.
  • When the carrier type[CarrierType]=”3″(customer’s cellphone bar code), then please fill in a fixed length of 8 and sequence format of 1 code slash “/” followed by a sequence of 7 numerical digits, cap-sized alphabet characters, and symbols such as【+】【-】【.】

❗ Special noted :

  1. When the cellphone carrier has a plus sign, then there might be an error during interfacing verification, please change the plus sign to a blank character.
  2. If the carrier number changes to mobile barcode carrier (a barcode of serial number on mobile), please firstly call Verifying the Existence of Mobile Barcode.

TaxType String(1)
Required

  • The Type of the tax
  • When [InvTyp] is 07 (general tax), please enter 1, 2, 3 or 9 in this field.
    If [InvType] is 08 (special tax), then please enter 3 or 4 in this field.
  • Parameter value explanation as follows:
    1. If it should be taxed, please fill in 1.
    2. If tax rate is zero, please fill in 2
    3. If it is duty free, please fill in 3.
    4. If it special tax computation, please fill in 4.
    5. If it has a combined tax and duty free, please fill in 9 (has to be approved).
  • ECPay tax calculation method:

    For regular invoices (non-combined tax, non-special):
    ( Invoice amount / 1.05 ) * 0.05, rounded to the nearest whole number.

    For combined tax invoices:
    ( Total sum of taxable items / 1.05 ) * 0.05, rounded to the nearest whole number.

SpecialTaxType Int

  • Special Tax Type
  • If [TaxType] is 1/2/9, please fill in 0.
    If [TaxType] is 3, please fill in 8.
    If [TaxType] is 4, and the parameter is required.
  • The parameter can fill in 1-8.
    1: Saloons and tea rooms, coffee shops and bars offering companionship services:Tax rate is 25%.
    2: Night clubs or restaurants providing entertaining show programs: Tax rate is 15%.
    3: Banking businesses, insurance businesses, trust investment businesses, securities businesses, futures businesses, commercial paper businesses and pawn-broking businesses: Tax rate is 2%.
    4: The sales amounts from reinsurance premiums shall be taxed at 1%.
    5: Banking businesses, insurance businesses, trust investment businesses, securities businesses, futures businesses, commercial paper businesses and pawn-broking businesses: Tax rate is 5%
    6: Core business revenues from the banking and insurance business of the banking and insurance industries (Applicable to sales after July 2014): Tax rate is 5%.
    7: Core business revenues from the banking and insurance business of the banking and insurance industries (Applicable to sales after June 2014): Tax rate is 5%.
    8: Duty free or non-output data.

SalesAmount Int
Required

  • E-Invoice total amount (Tax included)
  • Please designate full numbers, no decimals allowed.
  • New Taiwan Dollars only.

InvoiceRemark String(200)

  • E-Invoice Notation
  • The parameter shall be exempted when calculating the check digit.

Items Array[Object]

The product supports up to 999 items.

ItemSeq Int

  • Item Sequence Number
  • Please input 1~999 integer for this parameter.

ItemName String(100)
Required

Item Name

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

ItemPrice Number
Required

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

ItemTaxType String(1)

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

❗ Special notes : 

Preset is an empty string, when the tax category [TaxType] = 9, this parameter cannot be null.

ItemAmount Number
Required

  • Merchandise total amount (tax-included).
  • It could be up to 8 integers and 7 decimals after the decimal point.

❗ Special notes :

  1. If vat= 1, and TaxType= 1 or 4:
    ItemPrice(Tax)*ItemCount = ItemAmount(Tax)
    ex: 500* 5= 2500
  2. If vat= 0, and TaxType= 1(Tax rate is 5%):
    ItemPrice(duty free)*ItemCount*1.05= ItemAmount(Tax)
    ex: 500* 5* 1.05= 2625

ItemRemark String(40)

Merchandise notation explanation

InvType String(2)
Required

  • Type of letter track of e-invoice
  • Possible values:
    07: general tax (common business or e-commerce, which shall be no less than 5 %).
    08: special tax (i.e. for special food and beverage services enterprises, such as night clubs or restaurants providing entertaining show programs, saloons and tea rooms and bars offering companionship services).

DelayFlag String(1)
Required

  • Delayed notation
  • Can note that this E-Invoice shall be issued with delay or via trigger
    1: Delayed issuance
    2: Trigger issuance

DelayDay Int
Required

  • Amount of delayed days
  • If it is delayed issuance, the delayed days will need to be within 1 to 15 days
  • Trigger issuance can also designated delayed timing, but is limited to 0 to 15 days

❗ Special noted :

The invoice data cannot be cancelled after 10:00 AM on the date that is estimated to be created.

Tsr String(30)

Required

PayType String(1)

Required

  • Pay type
  • Please fill in ‘2’ automatically in the case of Green World

PayAct String(6)

Required

  • Pay type name
  • Please fill in ‘ECPAY’ automatically

NotifyURL String(200)

Notify the merchant’s system’s website upon issuance completion

vat String(1)

  • Whether merchandise unit price includes tax
  • Preset as included tax price
    1: Tax included
    0: Tax not included

Example

				
					{
    "MerchantID": "2000132",
    "RelateNumber": "20181028000000001",
    "CustomerID": "",
    "CustomerIdentifier": "",
    "CustomerName": "test",
    "CustomerAddr": "test",
    "CustomerPhone": "",
    "CustomerEmail": "test@ecpay.com.tw",
    "ClearanceMark": "1",
    "Print": "1",
    "Donation": "0",
    "LoveCode": "",
    "CarrierType": "",
    "CarrierNum": "",
    "TaxType": "1",
    "SalesAmount": 100,
    "InvoiceRemark": "",
    "InvType": "07",
    "DelayFlag": "1",
    "DelayDay": 5,
    "Tsr": "1231000000",
    "PayType": "2",
    "PayAct": "ECPAY", 
    "NotifyURL": "test@ecpay.com.tw",
    "vat": "1",
    "Items": [
        {
            "ItemSeq": 1,
            "ItemName": "item01",
            "ItemCount": 1,
            "ItemWord": "test",
            "ItemPrice": 50,
            "ItemTaxType": "1",
            "ItemAmount": 50,
            "ItemRemark": "item01_desc"
        },
        {
            "ItemSeq": 2,
            "ItemName": "item02",
            "ItemCount": 1,
            "ItemWord": "test",
            "ItemPrice": 20,
            "ItemTaxType": "1",
            "ItemAmount": 20,
            "ItemRemark": "item02_desc"
        },
        {
            "ItemSeq": 3,
            "ItemName": "item03",
            "ItemCount": 3,
            "ItemWord": "test",
            "ItemPrice": 10,
            "ItemTaxType": "1",
            "ItemAmount": 30,
            "ItemRemark": "item03_desc"
        }
    ]
}
				
			

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
  • Respond with 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 first and then perform 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 indicating whether the API is successfully executed or not.

OrderNumber String(30)

  • E-Invoice issuance complete
  • If issuance is a success, then the Tsr (Transaction Order) will be sent in response; If the issuance failed then a blank value will be sent in response.

Example

				
					{
   "RtnCode": 1,
   "RtnMsg": "",
   "OrderNumber": "1234000000"
}
				
			

ECPay’s response to NotifyURL

Message format:

  • Accept:text/html
  • Content-Type:application/x-www-form-urlencoded

NotifyURL

inv_mer_id String(10)

merchant ID

od_sob String(30)

merchant custom order code

tsr String(30)

Transaction Order

invoicedate String(10)

Date of e-invoice created

invoicetime String(8)

E-Invoice issuance time

invoicenumber String(10)

Issued E-Invoice number

invoicecode String(8)

Issued E-Invoice check digit

inv_error Int

error code

Example

				
					inv_mer_id=2000132&od_sob=20181028000000021&tsr=1231000000&invoicedate=2019-09-17&invoicetime=15:30:00&invoicenumber=UV11100012&invoicecode=12345678&inv_error=
				
			

YAML

The provided YAML file is used to define the configuration, structure, operations, and infrastructure management information of the API, making it easier for developers to understand and use the API.

				
					openapi: 3.1.0
info:
  title: ECPay Delay Issue Invoice API
  version: 1.0.0
servers:
  - url: https://einvoice-stage.ecpay.com.tw
  - url: https://einvoice.ecpay.com.tw
paths:
  /B2CInvoice/DelayIssue:
    post:
      summary: Delay Issue Invoice
      description: This API allows merchants to pre-schedule the issuance of invoices.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - MerchantID
                - RqHeader
                - Data
              properties:
                MerchantID:
                  type: string
                  maxLength: 10
                  description: Merchant ID
                RqHeader:
                  type: object
                  required:
                    - Timestamp
                  properties:
                    Timestamp:
                      type: integer
                      description: Unix timestamp in GMT+8
                Data:
                  type: string
                  description: Encrypted data
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  MerchantID:
                    type: string
                    description: Merchant ID
                  RqHeader:
                    type: object
                    properties:
                      Timestamp:
                        type: integer
                        description: Unix timestamp in GMT+8
                  Data:
                    type: string
                    description: Encrypted response data
components:
  schemas:
    requestBody.Data:
      type: object
      properties:
        MerchantID:
          type: string
          maxLength: 10
          description: Merchant ID
        RelateNumber:
          type: string
          maxLength: 30
          description: Custom unique identifier
        ChannelPartner:
          type: string
          maxLength: 1
          description: Channel partner ID
        CustomerID:
          type: string
          maxLength: 20
          description: Customer ID
        CustomerIdentifier:
          type: string
          maxLength: 8
          description: Customer tax ID
        CustomerName:
          type: string
          maxLength: 60
          description: Customer name
        CustomerAddr:
          type: string
          maxLength: 100
          description: Customer address
        CustomerPhone:
          type: string
          maxLength: 20
          description: Customer phone number
        CustomerEmail:
          type: string
          maxLength: 80
          description: Customer email
        ClearanceMark:
          type: string
          maxLength: 1
          description: Customs clearance mark
        Print:
          type: string
          maxLength: 1
          description: Print mark
        Donation:
          type: string
          maxLength: 1
          description: Donation mark
        LoveCode:
          type: string
          maxLength: 7
          description: Donation code
        CarrierType:
          type: string
          maxLength: 1
          description: Carrier type
        CarrierNum:
          type: string
          maxLength: 64
          description: Carrier number
        TaxType:
          type: string
          maxLength: 1
          description: Tax type
        SpecialTaxType:
          type: integer
          description: Special tax type
        SalesAmount:
          type: integer
          description: Total sales amount including tax
        InvoiceRemark:
          type: string
          maxLength: 200
          description: Invoice remark
        Items:
          type: array
          properties:
              ItemSeq:
                type: integer
                description: Item sequence
              ItemName:
                type: string
                maxLength: 100
                description: Item name
              ItemCount:
                type: number
                description: Item count
              ItemWord:
                type: string
                maxLength: 6
                description: Unit
              ItemPrice:
                type: number
                description: Item price
              ItemAmount:
                type: number
                description: Item amount
              ItemTaxType:
                type: string
                maxLength: 1
                description: Item tax type
    responses.Data:
      type: object
      properties:
        RtnCode:
          type: integer
          description: Response code
        RtnMsg:
          type: string
          description: Response message
        OrderNumber :
          type: string
          description: order number

				
			

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

Green World