2019-02-04 Cardless Credit
Pembayaran kredit tanpa kartu memungkinkan Anda untuk menerima pembayaran uang muka dari penyedia jasa kredit. Nasabah Anda juga mendapatkan pilihan untuk melakukan cicilan dengan tenor yang sesuai dengan kebutuhan nasabah.
Buat Pembayaran
Endpoint: Generate Checkout URL
POST https://api.xendit.co/cardless-credit
Versi
Anda sedang melihat API versi 2019-02-04. Versi yang terbaru telah tersedia!
Parameter Request
Contoh: Generate Checkout URL
curl https://api.xendit.co/cardless-credit -X POST \
-u xnd_development_O46JfOtygef9kMNsK+ZPGT+ZZ9b3ooF4w3Dn+R1k+2fT/7GlCAN3jg==: \
--header 'content-type: application/json' \
--data '{
"cardless_credit_type": "KREDIVO",
"external_id": "test-cardless-credit-01",
"amount": 800000,
"payment_type": "3_months",
"items": [
{
"id": "123123",
"name": "Phone Case",
"price": 200000,
"type": "Smartphone",
"url": "http://example.com/phone/phone_case",
"quantity": 2
},
{
"id": "234567",
"name": "Bluetooth Headset",
"price": 400000,
"type": "Audio",
"url": "http://example.com/phone/bluetooth_headset",
"quantity": 1
}
],
"customer_details": {
"first_name": "customer first name",
"last_name": "customer last name",
"email": "customer@yourwebsite.com",
"phone": "081513114262"
},
"shipping_address": {
"first_name": "first name",
"last_name": "last name",
"address": "Jalan Teknologi No. 12",
"city": "Jakarta",
"postal_code": "12345",
"phone": "081513114262",
"country_code": "IDN"
},
"redirect_url": "https://example.com",
"callback_url": "http://example.com/callback-cardless-credit"
}'
<?php
use Xendit\Xendit;
require 'vendor/autoload.php';
Xendit::setApiKey('xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw==');
$params = [
'cardless_credit_type' => 'KREDIVO',
'external_id' => 'test-cardless-credit-01',
'amount' => 800000,
'payment_type' => '3_months',
'items' => [
[
'id' => '123123',
'name' => 'Phone Case',
'price' => 200000,
'type' => 'Smartphone',
'url' => 'http=>//example.com/phone/phone_case',
'quantity' => 2
],
[
'id' => '234567',
'name' => 'Bluetooth Headset',
'price' => 400000,
'type' => 'Audio',
'url' => 'http=>//example.com/phone/bluetooth_headset',
'quantity' => 1
]
],
'customer_details' => [
'first_name' => 'customer first name',
'last_name' => 'customer last name',
'email' => 'customer@yourwebsite.com',
'phone' => '081513114262'
],
'shipping_address' => [
'first_name' => 'first name',
'last_name' => 'last name',
'address' => 'Jalan Teknologi No. 12',
'city' => 'Jakarta',
'postal_code' => '12345',
'phone' => '081513114262',
'country_code' => 'IDN'
],
'redirect_url' => 'https://example.com',
'callback_url' => 'http://example.com/callback-cardless-credit'
];
$createPayment = \Xendit\CardlessCredit::create($params);
var_dump($createPayment);
?>
Xendit.apiKey = "xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw==";
try {
//items
CardlessCreditItem items[] = new CardlessCreditItem[1];
items[0] =
CardlessCreditItem.builder()
.id("123")
.name("Phone Case")
.price(200000)
.type("Smartphone")
.url("https://www.example.org")
.quantity(1)
.build();
//address
CardlessCreditShippingAddress address =
CardlessCreditShippingAddress.builder()
.firstName("Lorem")
.lastName("Ipsum")
.address("Jalan teknologi")
.city("Jakarta")
.postalCode("12345")
.countryCode("IDN")
.phone("08129748247684")
.build();
//Customer
CardlessCreditCustomer customer =
CardlessCreditCustomer.builder()
.firstName("Lorem")
.lastName("Ipsum")
.email("email@example.com")
.phone("08129748247684")
.build();
CardlessCredit cardlessCredit = CardlessCredit.create(
"KREDIVO",
"external_id",
200000,
CardlessCredit.PaymentType.THREE_MONTHS.getVal(),
items,
customer,
address,
"www.example.com",
"www.example.com"
);
} catch (XenditException e) {
e.printStackTrace();
}
xendit.Opt.SecretKey = "xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw=="
createPaymentData := cardlesscredit.CreatePaymentParams{
CardlessCreditType: xendit.CardlessCreditTypeEnumKREDIVO,
ExternalID: "test-cardless-credit-01",
Amount: 200000,
PaymentType: xendit.PaymentTypeEnum3Months,
Items: []cardlesscredit.Item{
{
ID: "123",
Name: "Laptop Asus Ila",
Price: 200000,
Type: "Laptop",
URL: "http://asus-ila.com",
Quantity: 1,
},
},
CustomerDetails: cardlesscredit.CustomerDetails{
FirstName: "Michael",
LastName: "Belajarrock",
Email: "michaelbelajarrock@mail.com",
Phone: "08123123123",
},
ShippingAddress: cardlesscredit.ShippingAddress{
FirstName: "Michael",
LastName: "Belajarjazz",
Address: "Jalan Teknologi No. 12",
City: "Jakarta",
PostalCode: "40000",
Phone: "08123123123",
CountryCode: "IDN",
},
RedirectURL: "https://sandbox.kredivo.com/kredivo/v2/signin?tk=fKhTeBntLW3Zyu23+GQ6s+RQaMMRtQ6YdZA1bnbTszt9WXcph/B4+j8nuPlV599Rfkv85FAYuE21Suajpm45tEMZqjZIdqnSgIPlt7T5gJk=",
CallbackURL: "https://google.com",
}
resp, err := cardlesscredit.CreatePayment(&createPaymentData)
if err != nil {
log.Fatal(err)
}
fmt.Printf("created payment: %+v\n", resp)
from xendit import Xendit, CardlessCreditType
api_key = "xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw=="
xendit_instance = Xendit(api_key=api_key)
CardlessCredit = xendit_instance.CardlessCredit
cardless_credit_items = []
cardless_credit_items.append(
CardlessCredit.helper_create_item(
id="item-123",
name="Phone Case",
price=200000,
type="Smartphone",
url="http://example.com/phone/phone_case",
quantity=2,
)
)
customer_details = CardlessCredit.helper_create_customer_details(
first_name="customer first name",
last_name="customer last name",
email="customer@email.com",
phone="0812332145",
)
shipping_address = CardlessCredit.helper_create_shipping_address(
first_name="first name",
last_name="last name",
address="Jl Teknologi No. 12",
city="Jakarta",
postal_code="12345",
phone="081513114262",
country_code="IDN",
)
cardless_credit_payment = CardlessCredit.create_payment(
cardless_credit_type=CardlessCreditType.KREDIVO,
external_id="id-1595923113",
amount=10000,
payment_type="3_months",
items=cardless_credit_items,
customer_details=customer_details,
shipping_address=shipping_address,
redirect_url="https://my-shop.com/home",
callback_url="https://my-shop.com/callback",
)
print(cardless_credit_payment)
Contoh: Respon Sukses dari Generate Checkout URL
{
"redirect_url": "https://sandbox.kredivo.com/kredivo/v2/signin?tk=fKhTeBntLW3Zyu23+GQ6s+RQaMMRtQ6YdZA1bnbTszt9WXcph/B4+j8nuPlV599Rfkv85FAYuE21Suajpm45tEMZqjZIdqnSgIPlt7T5gJk=",
"transaction_id": "66403e84-c8da-4af4-8d30-d17e95522f43",
"order_id": "123456-test-cardless-credit-01",
"external_id": "test-cardless-credit-01",
"cardless_credit_type": "KREDIVO"
}
Parameter Body | Tipe | Deskripsi |
---|---|---|
cardless_credit_type required |
string |
Tipe dari Cardless Credit yang akan digunakan. Harus dalam huruf kapital. Tipe eWallet yang tersedia: OVO |
external_id required |
string |
Sebuah ID pilihan Anda. Seringkali ini adalah indentifikasi unik seperti nomor telepon, email atau ID transaksi. Panjang maksimum yang diperbolehkan adalah 1000 karakter. |
amount required |
number |
Jumlah yang pelanggan Anda harus bayarkan. Note: jumlah minimum adalah Rp 1. |
payment_type required |
string |
Tipe cicilan pembayaran, Anda bisa memilih antara: "30_days", "3_months", "6_months" and "12_months". |
items required |
array of item object |
Daftar barang / produk. |
item objectrequired |
item object |
Informasi dari barang atau produk, harus mengandung: id [string], name [string], price [number], type [string], url [string], quantity [number] |
customer_detailsrequired |
object |
Informasi pembeli, harus mengandung: first_name [string], last_name [string], email [string], phone [string] |
shipping_addressrequired |
object |
Informasi dari alamat pengiriman, harus mengandung: first_name [string], last_name [string], address [string], city [string], postal_code [string], phone [string], country_code [string] |
redirect_urlrequired |
string |
Setelah pembeli melakukan pembayaran di halaman checkout mitra Cardless Credit, mereka akan diarahkan ke redirect_url . Anda bisa memasukkan alamat dari halaman transaksi di website Anda ataupun halaman home website Anda. |
callback_urlrequired |
string |
Kami akan mengirimkan callback ke alamat ini setelah pembeli melakukan selesai melakukan pembayaran. |
Kode Error
Contoh: Respon Error dari Generate Checkout URL
{
"error_code": "API_VALIDATION_ERROR",
"message": "[fieldName] is required"
}
{
"error_code": "DUPLICATE_PAYMENT_ERROR",
"message": "Checkout URL with the same external_id has been created before."
}
Kode Error | Deskripsi |
---|---|
MERCHANT_NOT_FOUND422 |
Anda belum terdaftar untuk menggunakan cardless credit dengan tipe ini.. |
GENERATE_CHECKOUT_URL_ERROR422 |
Request Anda tidak memenuhi syarat atau ada masalah di sistem partner Cardless Credit kami. |
DUPLICATE_PAYMENT_ERROR422 |
Anda sudah pernah membuat Generate Checkout Request dengan external_id yang sama sebelumnya. |
REQUEST_FORBIDDEN403 |
API key yang digunakan tidak memiliki izin untuk melakukan request. Mohon berikan izin yang sesuai terhadap API key yang digunakan. Pelajari lebih lanjut disini |
Hitung Tipe Pembayaran
Fitur Perhitungan Tipe Pembayaran membantu Anda untuk menentukan cicilan yang terbaik yang akan ditawarkan ke nasabah Anda oleh penyedia jasa Kredit Tanpa Kartu. Anda dapat menggunakan API ini untuk menghitung serta menampilkan paket cicilan sebelum nasabah Anda melakukan otentikasi
Endpoint: Menghitung Tipe Pembayaran
POST https://api.xendit.co/cardless-credit/payment-types
Parameter Request
Contoh: Menghitung Tipe Pembayaran Request
curl https://api.xendit.co/cardless-credit/payment-types -X POST \
-u xnd_development_O46JfOtygef9kMNsK+ZPGT+ZZ9b3ooF4w3Dn+R1k+2fT/7GlCAN3jg==: \
--header 'content-type: application/json' \
--data '{
"cardless_credit_type": "KREDIVO",
"amount": 2000000,
"items": [
{
"id": "123123",
"name": "Phone Case",
"price": 1000000,
"type": "Smartphone",
"url": "http://example.com/phone/phone_case",
"quantity": 1
}
]
}'
<?php
$url = 'https://api.xendit.co/cardless-credit/payment-types';
$apiKey = 'xnd_development_O46JfOtygef9kMNsK+ZPGT+ZZ9b3ooF4w3Dn+R1k+2fT/7GlCAN3jg==:';
$headers = [];
$headers[] = 'Content-Type: application/json';
$item_1 = new stdClass();
$item_1->id = "123123";
$item_1->name = "Phone Case";
$item_1->price = 200000;
$item_1->type = "Smartphone";
$item_1->url = "http://example.com/phone/phone_case";
$item_1->quantity = 2;
$data = [
"cardless_credit_type" => "KREDIVO",
"amount" => 800000,
"items" => [ $item_1 ],
];
$curl = curl_init();
$payload = json_encode($data);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_USERPWD, $apiKey.":");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $payload);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($curl);
echo $result;
from xendit import Xendit, CardlessCreditType
api_key = "xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw=="
xendit_instance = Xendit(api_key=api_key)
CardlessCredit = xendit_instance.CardlessCredit
cardless_credit_items = []
cardless_credit_items.append(
CardlessCredit.helper_create_item(
id="item-123",
name="Phone Case",
price=200000,
type="Smartphone",
url="http://example.com/phone/phone_case",
quantity=2,
)
)
cardless_credit_payment_types = CardlessCredit.calculate_payment_type(
cardless_credit_type=CardlessCreditType.KREDIVO,
amount=10000,
items=cardless_credit_items,
)
print(cardless_credit_payment_types)
Parameter Body | Tipe | Deskripsi |
---|---|---|
cardless_credit_type required |
string |
Tipe cardless-credit yang akan dibayarkan. Harus dalam huruf kapital. Tipe Cardless credit yang didukung: KREDIVO |
amount required |
number |
Nominal yang akan dibayarkan oleh end customer. Note: nilai minimum adalah Rp 1 |
items required |
array of item object |
Daftar barang / produk. |
items.id required |
string |
Produk ID merchant dari produk spesifik dalam transaksi. |
items.name required |
string |
Nama spesifik produk dalam transaksi. |
items.price required |
number |
Harga per unit dari produk spesifik dalam transaksi. |
items.type required |
string |
Kategori dari produk spesifik dalam transaksi |
items.url required |
string |
Web url dari produk spesifik dalam transaksi. |
items.quantity required |
number |
Kuantitas dari produk spesifik dalam transaksi. |
Parameter Respon
Contoh: Respons dari Menghitung Tipe Pembayaran
{
"message": "Available payment types are listed.",
"payments": [
{
"raw_monthly_installment": 187534.6668043921,
"name": "Bayar dalam 6 bulan",
"amount": 1000000,
"installment_amount": 1125240,
"raw_amount": 1000000,
"rate": 2.95,
"down_payment": 0,
"monthly_installment": 187540,
"discounted_monthly_installment": 0,
"tenure": 6,
"id": "6_months"
},
{
"raw_monthly_installment": 1020000,
"name": "Bayar dalam 30 hari",
"amount": 1020000,
"installment_amount": 1020000,
"raw_amount": 1020000,
"rate": 0,
"down_payment": 0,
"monthly_installment": 1020000,
"discounted_monthly_installment": 0,
"tenure": 1,
"id": "30_days"
},
{
"raw_monthly_installment": 356786.46273702476,
"name": "Bayar dalam 3 bulan",
"amount": 1000000,
"installment_amount": 1070370,
"raw_amount": 1000000,
"rate": 2.95,
"down_payment": 0,
"monthly_installment": 356790,
"discounted_monthly_installment": 0,
"tenure": 3,
"id": "3_months"
}
]
}
Parameter | Tipe | Deskripsi |
---|---|---|
message required |
string |
Tipe pembayaran yang tersedia. |
payments required |
array |
Daftar tipe pembayaran yang dikalkulasi. |
payments.raw_monthly_installment required |
number |
Cicilan bulanan sebelum pembulatan. |
payments.name required |
string |
Nama cicilan. |
payments.amount required |
number |
Total pembayaran sebelum bunga. |
payments.installment_amount required |
number |
Total pembayaran setelah bunga. |
payments.raw_amount required |
number |
Nominal pembayaran sebelum bunga dan pembulatan. |
payments.rate required |
number |
Tarif bunga yang dikenakan pada transaksi. |
payments.down_payment required |
number |
Nilai pembayaran dimuak. |
payments.monthly_installment required |
number |
Cicilan bulanan yang ditawakan Kredivo pada end user. |
payments.discounted_monthly_installment required |
number |
Cicilan bulanan yang ditawakan Kredivo pada end user setelah diskon.(Jika ada) |
payments.tenure required |
number |
Pembayaran cicilan per bulan. |
payments.id required |
string |
ID dari tipe cicilan. |
Notifikasi Pembayaran
Xendit mengirim notifikasi pembayaran ke sistem Anda melalui callback. Anda perlu mempersiapkan URL untuk menerima callback dan mendaftarkan URL tersebut melalui Setelan Callback pada Dasbor Xendit.
Ketika pembayaran berhasil diproses, Xendit mengirimkan pesan ke URL menggunakan metode POST secara langsung melalui callback. Xendit turut melampirkan x-callback-token
header yang dapat Anda validasi dengan Token Verifikasi di Setelan Callback untuk mengecek keaslian pesan tersebut.
Kami harap sistem Anda dapat merespon callback dengan status 200
secepatnya. Xendit mengganggap callback gagal ketika kami tidak menerima respon dari sistem Anda selama 30 detik.
Data Callback
Contoh: Request Notifikasi Pembayaran / Callback
{
"external_id": "test-cardless-credit-01",
"order_id": "75191237c81273jajsh7291c-test-cardless-credit-01",
"transaction_id": "ashd7129-sh82-a9ks-js82-asj82912bajs",
"amount": 800000,
"transaction_status": "settlement",
"payment_type": "3_months",
"items": [
{
"id": "123123",
"name": "Phone Case",
"price": 200000,
"type": "Smartphone",
"url": "http://example.com/phone/phone_case",
"quantity": 2
},
{
"id": "234567",
"name": "Bluetooth Headset",
"price": 400000,
"type": "Audio",
"url": "http://example.com/audio/bluetooth_headset",
"quantity": 1
}
],
"customer_details": {
"first_name": "customer first name",
"last_name": "customer last name",
"email": "customer@yourwebsite.com",
"phone": "081513114262"
},
"shipping_address": {
"first_name": "first name",
"last_name": "last name",
"address": "Jalan Teknologi No. 12",
"city": "Jakarta",
"postal_code": "12345",
"phone": "081513114262",
"country_code": "IDN"
},
"cardless_credit_type": "KREDIVO",
"callback_authentication_token": "MuaJALKJSDK12LASHD123kSAKSDHzjahwUWjkasJSDSA12KSNAK21n=="
}
Header Parameter | Tipe | Description |
---|---|---|
x-callback-tokenrequired |
string |
Token unik akun Anda yang dapat digunakan untuk mengecek keaslian pesan |
Body Parameter | Tipe | Deskripsi |
---|---|---|
external_id | string |
Identifikasi dari pembayaran Anda, yang ada isi ketika mengirimkan Generate Checkout URL request. |
order_id | string |
Identifikasi unik yang kami berikan kepada mitra Cardless Credit kami. |
transaction_id | string |
ID transaksi yang diberikan oleh mitra Cardless Credit. |
transaction_status | string |
Status Transaksi, yang berisi: settlement: Transaksi berhasil pending: Pembeli belum melakukan pembayaran deny: Transaksi ditolak oleh mitra Cardless Credit kami cancel: Transaksi sudah dibatalkan expire: Pembeli tidak melakukan pembayaran dalam 24 jam, maka transaksi dinyatakan kadaluarsa |
payment_type | string |
Tipe cicilan. |
amount | number |
Jumlah pembayaran yang telah Anda isi ketika melakukan Generate Checkout URL request. |
items | array of item |
Daftar dari barang / produk yang ada isi ketika mengirimkan Generate Checkout URL request. |
item object |
item detail |
Informasi dari barang / produk, akan mengandung: id [string], name [string], price [number], type [string], url [string], quantity [number] |
customer_details | object |
Informasi pembeli, akan mengandung: first_name [string], last_name [string], email [string], phone [string] |
shipping_address | object |
Informasi alamat pengiriman, akan mengandung: first_name [string], last_name [string], address [string], city [string], postal_code [string], phone [string], country_code [string] |
cardless_credit_type | string |
Tipe Cardless Credit. Tipe Cardless Credit yang tersedia: KREDIVO |
callback_authentication_token | string |
Berisi Callback Verification API Key yang Anda bisa temukan di Dashboard Xendit. Anda perlu verifikasi kembali apakah ini memiliki isi yang sama |