ecforceのWebhook設定
ecforceからecforce checkに受注や顧客のデータを連携するために、ecforce管理画面でWebhookの設定をする必要があります。
以下の手順で設定をしてください。
Webhookについて
Webhookの詳細については、[オプション]Webhook 管理、[オプション]Webhook テンプレート管理をご参照ください。
Caution!!
「デフォルト(〇〇)」という名称のWebhookテンプレートは予め設置されているデフォルトのテンプレートで中身が異なりますので、新規に「check連携用」といった任意の名称でそれぞれ作成してください。
Webhookテンプレートの作成
決済 Webhook テンプレートの作成
【設定 > Webhook 管理 > 決済 Webhook テンプレート管理】画面にて、決済 Webhook用のテンプレートを作成する
▼項目「テンプレート」に設定する内容
{
"id": "{{ payment.order.id }}",
"number": "{{ payment.order.number }}",
"customer_id": "{{ payment.order.customer.id }}",
"prefecture_id": "{{ payment.order.billing_address.prefecture_id }}",
"name01": "{{ payment.order.billing_address.name01 }}",
"name02": "{{ payment.order.billing_address.name02 }}",
"kana01": "{{ payment.order.billing_address.kana01 }}",
"kana02": "{{ payment.order.billing_address.kana02 }}",
"zip01": "{{ payment.order.billing_address.zip01 }}",
"zip02": "{{ payment.order.billing_address.zip02 }}",
"addr01": "{{ payment.order.billing_address.addr01 }}",
"addr02": "{{ payment.order.billing_address.addr02 }}",
"addr03": "{{ payment.order.billing_address.addr03 }}",
"tel01": "{{ payment.order.billing_address.tel01 }}",
"tel02": "{{ payment.order.billing_address.tel02 }}",
"tel03": "{{ payment.order.billing_address.tel03 }}",
"email": "{{ payment.order.customer.email }}",
"times": "{{ payment.order.times }}",
"state": "{{ payment.order.state }}",
"human_state_name": "{{ payment.order.human_state_name }}",
"payment_state": "{{ payment.state }}",
"payment_state_name": "{{ payment.human_state_name }}",
"base_url": "{{ payment.order.url.base_url }}",
"customer_number": "{{ payment.order.customer.number }}",
"total": "{{ payment.order.total }}",
"payment_method_name": "{{ payment.payment_method.name }}",
"item_id": "{{ payment.order.order_items | map: 'id' | join: '_||_' }}",
"item_product_id": "{{ payment.order.order_items | map: 'product' | map: 'id' | join: '_||_' }}",
"item_product_number": "{{ payment.order.order_items | map: 'product' | map: 'number' | join: '_||_' }}",
"item_product_name": "{{ payment.order.order_items | map: 'product' | map: 'name' | join: '_||_' }}",
"item_variant_id": "{{ payment.order.order_items | map: 'variant_id' | join: '_||_' }}",
"item_variant_sku": "{{ payment.order.order_items | map: 'variant' | map: 'sku' | join: '_||_' }}",
"item_variant_name": "{{ payment.order.order_items | map: 'variant' | map: 'name' | join: '_||_' }}",
"item_quantity": "{{ payment.order.order_items | map: 'quantity' | join: '_||_' }}",
"item_price": "{{ payment.order.order_items | map: 'price' | join: '_||_' }}",
"subs_order_item_id": "{{ payment.order.subs_order.order_items | map: 'id' | join: '_||_' }}",
"subs_order_id": "{{ payment.order.subs_order.id }}",
"subs_order_number": "{{ payment.order.subs_order.number }}",
"completed_at": "{{ payment.order.completed_at | date: '%Y/%m/%d %H:%M:%S' }}",
"scheduled_to_be_shipped_at": "{{ payment.order.subs_order.scheduled_to_be_shipped_at | date: '%Y/%m/%d' }}",
"scheduled_to_be_delivered_at": "{{ payment.order.subs_order.scheduled_to_be_delivered_at | date: '%Y/%m/%d' }}",
"tenant_id": "{{ payment.order.tenant_id }}"
}
顧客 Webhook テンプレートの作成
【設定 > Webhook 管理 > 顧客 Webhook テンプレート管理】画面にて、顧客 Webhook用のテンプレートを作成する
▼項目「テンプレート」に設定する内容
{
"id":"{{ customer.id }}",
"email":"{{ customer.email }}",
"sex_id":"{{ customer.sex.id }}",
"birth":"{{ customer.birth | date: '%Y/%m/%d'}}",
"line_id":"{{ customer.line_id }}",
"name01":"{{ customer.billing_address.name01 }}",
"name02":"{{ customer.billing_address.name02 }}",
"kana01":"{{ customer.billing_address.kana01 }}",
"kana02":"{{ customer.billing_address.kana02 }}",
"tel01":"{{ customer.billing_address.tel01 }}",
"tel02":"{{ customer.billing_address.tel02 }}",
"tel03":"{{ customer.billing_address.tel03 }}",
"zip01":"{{ customer.billing_address.zip01 }}",
"zip02":"{{ customer.billing_address.zip02 }}",
"prefecture_id":"{{ customer.billing_address.prefecture_id }}",
"addr01":"{{ customer.billing_address.addr01 }}",
"addr02":"{{ customer.billing_address.addr02 }}",
"addr03":"{{ customer.billing_address.addr03 }}",
"optin":"{{ customer.optin }}",
"tenant_id":"{{ customer.tenant_id }}"
}
住所 Webhook テンプレートの作成
【設定 > Webhook 管理 > 住所 Webhook テンプレート管理】画面にて、住所 Webhook用のテンプレートを作成する
▼項目「テンプレート」に設定する内容
{ "addressable_id": "{{ address.addressable_id }}", "addressable_type": "{{ address.addressable_type }}", "address_type": "{{ address.type }}", "name01": "{{ address.name01 }}", "name02": "{{ address.name02 }}", "kana01": "{{ address.kana01 }}", "kana02": "{{ address.kana02 }}", "tel01": "{{ address.tel01 }}", "tel02": "{{ address.tel02 }}", "tel03": "{{ address.tel03 }}", "zip01": "{{ address.zip01 }}", "zip02": "{{ address.zip02 }}", "prefecture_id": "{{ address.prefecture_id }}", "addr01": "{{ address.addr01 }}", "addr02": "{{ address.addr02 }}", "addr03": "{{ address.addr03 }}" }
Webhookの作成
決済 Webhookの作成
【設定 > Webhook 管理 > 決済 Webhook 管理】画面にて、以下の内容のWebhookを作成する
※イベントの個数分のWebhookを作成してください。
項目 | 設定内容 |
---|---|
URL | https://check-ec-force.com/admin/check/webhook |
イベント名 | payment_registration_failed payment_credit_exam_failed payment_credit_exam_hold payment_credit_exam_processing payment_credit_exam_completed payment_cash_on_delivery_authed payment_authed payment_auth_failed payment_update_failed payment_completed payment_sales_failed payment_void payment_void_failed payment_shipment_report_waiting payment_shipment_report_failed |
テンプレート | 手順1で作成した決済 Webhook テンプレート |
顧客 Webhookの作成
【設定 > Webhook 管理 > 顧客 Webhook 管理】画面にて、以下の内容のWebhookを作成する
項目 | 設定内容 |
---|---|
URL | https://check-ec-force.com/admin/check/webhook |
イベント名 | customer_updated |
テンプレート | 手順2で作成した顧客 Webhook テンプレート |
住所 Webhookの作成
【設定 > Webhook 管理 > 住所 Webhook 管理】画面にて、以下の内容のWebhookを作成する
項目 | 設定内容 |
---|---|
URL | https://check-ec-force.com/admin/check/webhook |
イベント名 | address_customer_billing_updated |
テンプレート | 手順3で作成した住所 Webhook テンプレート |
定期受注 Webhookの作成
【設定 > Webhook 管理 > 定期受注 Webhook 管理】画面にて、以下の内容のWebhookを作成する
項目 | 設定内容 |
---|---|
URL | https://check-ec-force.com/admin/check/webhook |
イベント名 | subs_order_active subs_order_canceled subs_order_suspend subs_order_destroyed |
テンプレート | デフォルトの定期受注 Webhook テンプレート |
この記事の目次
このセクションの記事