xendit docs

Invoices

Deskripsi

Kami menggunakan kata Invoice untuk mendeskripsikan pengajuan untuk uang di bayarkan kepada Anda, contoh: "uang masuk". ini bisa jadi sebuah invoice tradisional atau seseorang mengecek halaman eCommerce . Xendit menyediakan cara yang lebih baik untuk memberikan invoice kepada pelanggan Anda, baik itu invoice sekali pakai, layanan berlangganan, atau diantaranya. Kami memiliki solusi untuk Anda. yaitu antarmuka Invoice yang otomatis menampilkan semua pilihan pembayaran atau anda dapat menggunakan antarmuka sendiri yang dihubungkan dengan API kami. Invoice dapat dibayar berdasarkan kepada pilihan pembayaran yang sudah Anda konfigurasikan, contoh: Mandiri virtual accounts , Alfamart outlet ritel dan kartu kredit.

Coba Sekarang (Try it now)

INVOICE
PAYMENT
SUCCESS

Membuat invoice (Create Invoice)

Kami akan membuat invoice yang mana akan kami bayarkan jadi anda bisa melihat bagaimana cara invoice kami bekerja.

Mari kita jalankan curl request di terminal anda. anda bebas untuk mengubah semua parameter .

We will create an invoice which we will then pay so you can see how our invoice flow works.

Let’s start by running the curl request in your terminal. Feel free to edit any of the parameters.

 curl https://api.xendit.co/v2/invoices -X POST \
	 -u xnd_development_O46JfOtygef9kMNsK+ZPGT+ZZ9b3ooF4w3Dn+R1k+2fT/7GlCAN3jg==: \
	 -d external_id=demo-1531960366017 \
	 -d payer_email=sample_email@xendit.co \
	 -d description='Trip to Bali' \
	 -d amount=52000 

Proses Invoicing

Implementasi Invoice

Ikuti langkah berikut untuk mengimplementasi invoice API kami.

Anda butuh untuk melakukan POST request ini. Aksi ini akan membuat sebuah invoice yang mana pelanggan Anda bisa bayar dengan cara yang sudah Anda konfigurasi sebelumnya di dalam dasbor . untuk mempelajari lebih lanjut tentang parameter , Anda bisa cek di referensi API kami

  • Curl
  • PHP
curl https://api.xendit.co/v2/invoices -X POST \
	 -u xnd_development_O46JfOtygef9kMNsK+ZPGT+ZZ9b3ooF4w3Dn+R1k+2fT/7GlCAN3jg==: \
	 -d external_id=demo_1475801962607 \
	 -d payer_email=sample_email@xendit.co \
	 -d description='Trip to Bali' \
     -d amount=13000

Kami telah mengisikan contoh di atas dengan sample API key . Jika Anda sudah login , Anda dapat melihat test key dan hanya Anda yang bisa melihat key tersebut

Secara bawaan, invoice akan kedaluwarsa setelah 24 jam. Jika Anda ingin mengubahnya, silahkan kontak Customer Support kami, dan kami akan mengubahnya untuk Anda.

PARAMETER DESKRIPSI
external_id

ID pilihan Anda (biasanya pengenal yang unik untuk invoice di dalam sistem Anda)

payer_email

Email pelanggan yang ingin Anda tujukan untuk membayar

description

Deskripsi invoice

amount

Jumlah invoice , jumlah minimal untuk membuat invoice adalah 11000

Invoice kami akan mengembalikan response , berikut contoh response dari API kami.

Response: 200

{
    "id": "59d4c981997f96da6b69d24a",
    "external_id": "demo-1475801962607",
    "user_id": "59d4c95053db7ba6123971b1",
    "status": "PENDING",
    "merchant_name": "Xendit",
    "merchant_profile_picture_url": "https://du8nwjtfkinx.cloudfront.net/xendit.png",
    "amount": 13000,
    "payer_email": "sample_email@xendit.co",
    "description": "Trip to Bali",
    "expiry_date": "2017-10-05T11:44:00.736Z",
    "invoice_url": "https://invoice-staging.xendit.co/web/invoices/57f6f439b33bed606c4dae86",
    "available_banks": [
        {
            "bank_code": "MANDIRI",
            "collection_type": "POOL",
            "bank_account_number": "88464100767",
            "transfer_amount": 13000,
            "bank_branch": "Virtual Account",
            "account_holder_name": "XENDIT",
            "identity_amount": 0
        },
        {
            "bank_code": "BCA",
            "collection_type": "POOL",
            "bank_account_number": "02938103212",
            "transfer_amount": 13000,
            "bank_branch": "Virtual Account",
            "account_holder_name": "XENDIT",
            "identity_amount": 0
        },
        {
            "bank_code": "BNI",
            "collection_type": "POOL",
            "bank_account_number": "26215100282",
            "transfer_amount": 13000,
            "bank_branch": "Virtual Account",
            "account_holder_name": "XENDIT",
            "identity_amount": 0
        },
        {
            "bank_code": "BRI",
            "collection_type": "POOL",
            "bank_account_number": "8808104859",
            "transfer_amount": 13000,
            "bank_branch": "Virtual Account",
            "account_holder_name": "XENDIT",
            "identity_amount": 0
        }
    ],
    "available_retail_outlets": [
        {
            "retail_outlet_name": "ALFAMART",
            "payment_code": "ALFA123456",
            "transfer_amount": 54000
        }
    ],
    "should_exclude_credit_card": false,
    "should_send_email": false,
    "created": "2017-10-04T11:44:01.137Z",
    "updated": "2017-10-04T11:44:01.137Z"
}
PARAMETER DESKRIPSI
id

ID invoice yang dihasilkan oleh Xendit

user_id

ID Xendit Anda, untuk keperluan internal

external_id

ID pilihan Anda yang kami tambahkan ke semua transaksi. Seringkali ID unik Anda seperti nomor telepon, email, atau ID transaksi.

status

PENDING - invoice belum dibayar

PAID - invoice telah berhasil dibayar

SETTLED - invoice telah dimasukan ke saldo kas

merchant_name

Nama perusahaan atau situs web Anda

merchant_profile_picture

URL ke gambar profil perusahaan Anda

amount

Jumlah nominal untuk invoice (tanpa pajak, biaya)

payer_email

Email dari pembayar, kami mendapatkan informasi ini dari panggilan API Anda

description

Deskripsi untuk invoice , kami mendapatkan informasi ini dari panggilan API Anda

expiry_date

Tanggal kedaluwarsa dari sebuah invoice . Kami menyediakan nomor unik hanya untuk jangka waktu tertentu. Setelah itu, kami akan menyetel ulang dengan nomor yang berbeda.

invoice_url

URL publik untuk invoice ini, ada jika Anda ingin menggunakan UI kami

available_banks
bank_code
collection_type

bank_branch
account_holder_name
bank_account_number
transfer_amount
identity_amount

Metode pembayaran dan bank yang tersedia sesuai dengan konfigurasi Anda

Kode bank. Perlu melihat semua kode bank

POOL - bank ini akan menggunakan kumpulan virtual accounts kami untuk identifikasi

Nama cabang bank

Nama akun bank

Nomor rekening bank yang harus dibayarkan

Jumlah yang harus ditransfer oleh pelanggan

Jumlah untuk membantu mengidentifikasi pembayaran

available_retail_outlets
payment_code


transfer_amount

Pilihan pembayaran outlet ritel yang tersedia sesuai dengan konfigurasi Anda

Kode pembayaran unik digunakan untuk mengidentifikasi transaksi saat membayar di gerai ritel. Ini akan terdiri dari awalan Anda + string yang dihasilkan secara acak

Jumlah yang harus di bayar

should_exclude_credit_card

Sebuah penanda yang menunjukkan apakah kartu kredit harus dihilangkan dalam UI invoice

should_send_email

Sebuah penanda yang menunjukkan pembayar harus mendapatkan email ketika invoice dibuat, dibayar, atau kedaluwarsa; atau tidak

updated

ISO timestamp yang melacak kapan invoice diperbarui

created

ISO timestamp yang melacak kapan invoice dibuat

Setelah pembayaran terpenuhi, kami mengirimkan callback untuk memberitahu Anda tentang keberhasilan pembayaran. Anda harus memberi kami URL callback . Di bawah ini kami memberikan contoh tentang implementasi callback client dari sisi Anda.

  • PHP
<?php
    if ($_SERVER["REQUEST_METHOD"] === "POST") {
        $data = file_get_contents("php://input");

        print_r("\n\$data contains the updated invoice data \n\n");
        print_r($data);
        print_r("\n\nUpdate your database with the invoice status \n\n");
    } else {
        print_r("Cannot ".$_SERVER["REQUEST_METHOD"]." ".$_SERVER["SCRIPT_NAME"]);
    }
?>

Selamat! Itu saja - Anda sekarang siap untuk dibayar dengan Xendit.

Langkah selanjutnya

Pertanyaan?

Masih memiliki pertanyaan? Dengan senang hati kami akan membantu Anda. Kirimkan email atau pesan melalui live chat .

Invoices

Description

We use the word invoice to describe a request for money to be paid to you, i.e. “money in”. This could be a traditional invoice or someone checking out your eCommerce page. Xendit provides a great way to invoice your customers whether it is a one off invoice, a subscription service, or something in between, we have a solution for you. We have an invoice UI that automatically shows all the payment options you’ve chosen to allow, or use your own UI and connect us purely through API. Invoices can be paid based on the payment options you configure, e.g. Mandiri virtual accounts, Alfamart retail outlets and/or credit card.

Try it now

INVOICE
PAYMENT
SUCCESS

Membuat invoice (Create Invoice)

Kami akan membuat invoice yang mana akan kami bayarkan jadi anda bisa melihat bagaimana cara invoice kami bekerja.

Mari kita jalankan curl request di terminal anda. anda bebas untuk mengubah semua parameter .

We will create an invoice which we will then pay so you can see how our invoice flow works.

Let’s start by running the curl request in your terminal. Feel free to edit any of the parameters.

 curl https://api.xendit.co/v2/invoices -X POST \
	 -u xnd_development_O46JfOtygef9kMNsK+ZPGT+ZZ9b3ooF4w3Dn+R1k+2fT/7GlCAN3jg==: \
	 -d external_id=demo-1531960366024 \
	 -d payer_email=sample_email@xendit.co \
	 -d description='Trip to Bali' \
	 -d amount=33000 

Invoicing process

Implementing Invoices

Follow the steps below to implement our invoices API.

You’ll need to POST this request. It will create an invoice which your customers can pay with the methods you have configured within the dashboard . Learn more about the parameters in our API reference docs.

  • Curl
  • PHP
curl https://api.xendit.co/v2/invoices -X POST \
	 -u xnd_development_O46JfOtygef9kMNsK+ZPGT+ZZ9b3ooF4w3Dn+R1k+2fT/7GlCAN3jg==: \
	 -d external_id=demo_1475801962607 \
	 -d payer_email=sample_email@xendit.co \
	 -d description='Trip to Bali' \
     -d amount=13000

We have prefilled the above example with a sample API key. If you're logged in, you'll see your specific test key. Only you can see this key.

By default, invoices will expire after 24 hours. If you would like to change the default for your account, please contact support and we can change it for you.

PARAMETER DESCRIPTION
external_id

ID of your choice (typically the unique identifier of an invoice in your system)

payer_email

Email of the end user you're charging

description

Description of the invoice

amount

Amount on the invoice. The minimum amount to create an invoice is 11000.

Our invoice API will then return a response. We explain the response below.

Response: 200

{
    "id": "59d4c981997f96da6b69d24a",
    "external_id": "demo-1475801962607",
    "user_id": "59d4c95053db7ba6123971b1",
    "status": "PENDING",
    "merchant_name": "Xendit",
    "merchant_profile_picture_url": "https://du8nwjtfkinx.cloudfront.net/xendit.png",
    "amount": 13000,
    "payer_email": "sample_email@xendit.co",
    "description": "Trip to Bali",
    "expiry_date": "2017-10-05T11:44:00.736Z",
    "invoice_url": "https://invoice-staging.xendit.co/web/invoices/57f6f439b33bed606c4dae86",
    "available_banks": [
        {
            "bank_code": "MANDIRI",
            "collection_type": "POOL",
            "bank_account_number": "88464100767",
            "transfer_amount": 13000,
            "bank_branch": "Virtual Account",
            "account_holder_name": "XENDIT",
            "identity_amount": 0
        },
        {
            "bank_code": "BCA",
            "collection_type": "POOL",
            "bank_account_number": "02938103212",
            "transfer_amount": 13000,
            "bank_branch": "Virtual Account",
            "account_holder_name": "XENDIT",
            "identity_amount": 0
        },
        {
            "bank_code": "BNI",
            "collection_type": "POOL",
            "bank_account_number": "26215100282",
            "transfer_amount": 13000,
            "bank_branch": "Virtual Account",
            "account_holder_name": "XENDIT",
            "identity_amount": 0
        },
        {
            "bank_code": "BRI",
            "collection_type": "POOL",
            "bank_account_number": "8808104859",
            "transfer_amount": 13000,
            "bank_branch": "Virtual Account",
            "account_holder_name": "XENDIT",
            "identity_amount": 0
        }
    ],
    "available_retail_outlets": [
        {
            "retail_outlet_name": "ALFAMART",
            "payment_code": "ALFA123456",
            "transfer_amount": 54000
        }
    ],
    "should_exclude_credit_card": false,
    "should_send_email": false,
    "created": "2017-10-04T11:44:01.137Z",
    "updated": "2017-10-04T11:44:01.137Z"
}
PARAMETER DESCRIPTION
id

An invoice ID which is generated by Xendit

user_id

Your Xendit ID as we see you - for internal purposes :P

external_id

An ID of your choice we append to all transactions. Often your unique ID like a phone number, email or transaction ID.

status

PENDING - the invoice has yet to be paid

PAID - the invoice has successfully been paid

SETTLED - the amount of paid invoice has been settled to cash balance

merchant_name

The name of your company or website

merchant_profile_picture

The URL to profile picture of your company

amount

Nominal amount for the invoice (without taxes, fees)

payer_email

Email of the payer, we get this information from your API call

description

Description for the invoice, we get this information from your API call

expiry_date

ISO date and time that the invoice expires. We reserve unique numbers only for a specific period of time. After that, we’ll reset with a different number.

invoice_url

Public URL for this invoice, it’s there in case you want to use our UI

available_banks
bank_code
collection_type

bank_branch
account_holder_name
bank_account_number
transfer_amount
identity_amount

Available payment methods and banks as per your configuration

Code of the banks. Need to see all bank codes

POOL - this bank will use our pool of virtual accounts for identification

Name of the bank branch

Name of the bank account

Bank account number they should pay into

Amount the user should transfer

Amount to help identify the payment

available_retail_outlets
payment_code


transfer_amount

Available retail outlet payment channels as per your configuration

Unique payment code used to identify the transaction when paying at the retail outlet. This will consist of your prefix + a randomly generated string

Amount the user should pay

should_exclude_credit_card

A flag showing if credit card should be excluded in invoice UI or not

should_send_email

A flag showing should payer get email when invoice is created, paid, or expired; or not

updated

An ISO timestamp that tracks when the invoice was updated

created

An ISO timestamp that tracks when the invoice was created

Once a payment is fulfilled, we initiate a callback to notify you of payment success. You’ll need to provide us a callback URL. Below we’ve included an example of what a callback client may look like from your side.

  • PHP
<?php
    if ($_SERVER["REQUEST_METHOD"] === "POST") {
        $data = file_get_contents("php://input");

        print_r("\n\$data contains the updated invoice data \n\n");
        print_r($data);
        print_r("\n\nUpdate your database with the invoice status \n\n");
    } else {
        print_r("Cannot ".$_SERVER["REQUEST_METHOD"]." ".$_SERVER["SCRIPT_NAME"]);
    }
?>

Congrats! That’s it - you’re now set to get paid with Xendit.

Next Steps

Questions?

Still have more questions? We're always happy to help however we can. Shoot us an email or chat to us in live chat.