Skip to content

Latest commit

 

History

History
73 lines (59 loc) · 2.01 KB

invoice.md

File metadata and controls

73 lines (59 loc) · 2.01 KB

Invoice API

Generating New Invoice

Use this endpoint to create a payment request to chosen payment channels and gateway.

Request

POST /payment/invoices
{
  "payment": {
    "payment_type": "ovo"
  },
  "customer": {
    "name": "John",
    "email": "[email protected]",
    "phone_number": "089922222222"
  },
  "items": [{
    "name": "Support Podcast",
    "category": "PODCAST",
    "merchant": "imrenagi.com",
    "description": "donasi podcast imre nagi",
    "qty": 1,
    "price": 80001,
    "currency": "IDR"
  }]
}

To create invoice with credit_card payment with/without installment, please take a look POSTMAN COLLECTION

Response

When you call endpoint above, server returns all invoice data. But, to proceed to the payment page you need to pay attention to payment object.

{
  "payment": {
    "id": 48,
    "created_at": "2020-05-25T23:31:44.99873+07:00",
    "updated_at": "2020-05-25T23:31:44.99873+07:00",
    "deleted_at": null,
    "gateway": "xendit",
    "payment_type": "ovo",
    "token": "",
    "redirect_url": "https://invoice.xendit.co/web/invoices5ecbf2f0689543409347ec15",
    "transaction_id": "5ecbf2f0689543409347ec15"
  }
}

❗❗❗ Please note:

For Midtrans Payment Channel

  • Value of payment.gateway will is always midtrans
  • You can use payment.token to open snap window by using midtrans snap.js
  • If you want to use Window Redirection, you can open a new browser tab by using url in payment.redirect_url

For Xendit Payment Channel

  • Value of payment.gateway will is always xendit
  • payment.token is always empty for all xendit provided payment channels
  • You will always open payment.redirect_url in new browser tap for all payment methods provided by xendit. Including DANA, LinkAja, Kredivo, even Xendit Invoice.