Pendahuluan
Sinkronkan data pembayaran Anda langsung ke HubSpot CRM. Buat kontak dari pembayaran yang berhasil, lacak siklus hidup langganan, dan bangun profil pelanggan yang komprehensif—semuanya dipicu secara otomatis oleh peristiwa Dodo Payments.
Integrasi ini memerlukan akses admin HubSpot untuk mengonfigurasi cakupan OAuth dan izin API.
Memulai
Open the Webhook Section
Di dasbor Dodo Payments Anda, buka Webhooks → + Tambah Endpoint dan kembangkan dropdown integrasi.
Select HubSpot
Pilih kartu integrasi HubSpot .
Connect HubSpot
Klik Connect to HubSpot dan otorisasi cakupan OAuth yang diperlukan.
Configure Transformation
Edit kode transformasi untuk memetakan data pembayaran ke objek CRM HubSpot.
Test & Create
Uji dengan payload sampel dan klik Create untuk mengaktifkan sinkronisasi.
Done!
🎉 Event pembayaran sekarang akan secara otomatis membuat/memperbarui catatan di CRM HubSpot Anda.
Buat Kontak dari Pembayaran
function handler ( webhook ) {
if ( webhook . eventType === "payment.succeeded" ) {
const p = webhook . payload . data ;
webhook . url = "https://api.hubapi.com/crm/v3/objects/contacts" ;
webhook . payload = {
properties: {
email: p . customer . email ,
firstname: p . customer . name . split ( ' ' )[ 0 ] || '' ,
lastname: p . customer . name . split ( ' ' ). slice ( 1 ). join ( ' ' ) || '' ,
phone: p . customer . phone || '' ,
company: p . customer . company || '' ,
amount: ( p . total_amount / 100 ). toString (),
payment_method: p . payment_method || '' ,
currency: p . currency || 'USD'
}
};
}
return webhook ;
}
See all 19 lines
Perbarui Kontak dengan Langganan
function handler ( webhook ) {
if ( webhook . eventType === "subscription.active" ) {
const s = webhook . payload . data ;
webhook . url = `https://api.hubapi.com/crm/v3/objects/contacts/ ${ s . customer . customer_id } ` ;
webhook . method = "PATCH" ;
webhook . payload = {
properties: {
subscription_status: "active" ,
subscription_amount: ( s . recurring_pre_tax_amount / 100 ). toString (),
subscription_frequency: s . payment_frequency_interval ,
next_billing_date: s . next_billing_date ,
product_id: s . product_id
}
};
}
return webhook ;
}
See all 17 lines
Buat Kesepakatan dari Pembayaran
function handler ( webhook ) {
if ( webhook . eventType === "payment.succeeded" ) {
const p = webhook . payload . data ;
webhook . url = "https://api.hubapi.com/crm/v3/objects/deals" ;
webhook . payload = {
properties: {
dealname: `Payment - ${ p . customer . email } ` ,
amount: ( p . total_amount / 100 ). toString (),
dealstage: "closedwon" ,
closedate: new Date (). toISOString (),
hs_currency: p . currency || "USD"
},
associations: [
{
to: {
id: p . customer . customer_id
},
types: [
{
associationCategory: "HUBSPOT_DEFINED" ,
associationTypeId: 3
}
]
}
]
};
}
return webhook ;
}
See all 29 lines
Tips
Gunakan penjelajah API HubSpot untuk menguji pembuatan objek
Pemetaan jumlah pembayaran ke bidang mata uang HubSpot
Sertakan ID pelanggan untuk asosiasi yang tepat
Atur tahap kesepakatan yang sesuai berdasarkan status pembayaran
Pemecahan Masalah
Records not created in HubSpot
Verifikasi cakupan OAuth mencakup izin tulis
Periksa bahwa properti HubSpot yang diperlukan ada
Pastikan email pelanggan valid dan unik
Tinjau batas laju API HubSpot