MENU

料金プラン

機能一覧

デモ

ご利用の流れ

お役立ちコラム



支払い

操作ガイド

Amelia API – 支払い

ここでは、支払いに関連するAPIエンドポイントをご覧いただけます。

すべてのAPIエンドポイントと、リクエストおよびレスポンスの例は、こちらからダウンロードできるAmelia API Postmanコレクションで確認できます。

ご注意ください: APIエンドポイントの使用には、一定のコーディングスキルが必要であり、プラグインで提供されるサポートには含まれていません。

認証

すべてのAmeliaエンドポイントは、Ameliaという名前のヘッダープロパティを使用したAPIキー認証を採用しています。

パス

Amelia APIのパスは以下で始まります:{{your_site_URL}}/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1

支払いの追加

予約に支払いを追加します。

メソッド

このエンドポイントはPOSTリクエストを受け付けます。

パス

/payments

必須プロパティ

以下のプロパティは必須です。

キータイプ説明
customerBookingIdinteger支払いを関連付ける予約ID。
amountnumber支払い金額。
gatewaystring支払いのゲートウェイ。使用可能な値:onSite当日払い)、payPalstripewcmollierazorpay
statusstring支払いのステータス。使用可能な値:paid(支払い済み)、pending(保留中)、partiallyPaid(一部支払い済み)、refunded(払い戻し済み)
packageCustomerIdintegerコースお客様オブジェクトID。支払いがコースに関連する場合に必須です。
entitystringエンティティタイプ。使用可能な値:appointment(予約)、event(イベント)、packageコース

その他のプロパティ

キータイプ説明
dateTimestring支払いが実行された、または実行される予定の日時(オンライン支払い方法の場合は現在、当日払いの場合は予約日時)。形式:YYYY-MM-DD HH:mm
gatewayTitlestringWooCommerceを使用している場合の特定のゲートウェイタイトル。例:Stripe、代金引換、銀行振込
actionsCompletedboolean予約後のアクションが完了したかどうか。
wcOrderIdintegerWooCommerce注文ID。
transactionIdstringオンラインゲートウェイの取引ID。WooCommerceを使用していない場合の払い戻しアクションに使用されます。

リクエスト
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/payments' \
--data '{
"customerBookingId": 268,
"amount": 10,
"dateTime": "2023-05-05 15:00:00",
"status": "paid",
"gateway": "stripe",
"data": {},
"packageCustomerId": null,
"entity": "appointment"
}'
レスポンス
{
"message": "New payment successfully created.",
"data": {
"payment": {
"id": null,
"customerBookingId": 268,
"packageCustomerId": null,
"parentId": null,
"amount": 10,
"gateway": "stripe",
"gatewayTitle": "",
"dateTime": "2023-05-05 15:00:00",
"status": "paid",
"data": "[]",
"entity": "appointment",
"created": null,
"actionsCompleted": null,
"wcOrderId": null,
"wcOrderUrl": null,
"wcItemCouponValue": null,
"wcItemTaxValue": null
}
}
}

支払いの更新

支払い詳細を更新します。

メソッド

このエンドポイントはPOSTリクエストを受け付けます。

パス

/payments/{{payment_id}}

オプションのプロパティ

更新したいプロパティのみを送信してください。

キータイプ説明
customerBookingIdinteger支払いを関連付ける予約ID。
amountnumber支払い金額。
gatewaystring支払いのゲートウェイ。使用可能な値:onSite当日払い)、payPalstripewcmollierazorpay
statusstring支払いのステータス。使用可能な値:paid(支払い済み)、pending(保留中)、partiallyPaid(一部支払い済み)、refunded(払い戻し済み)
packageCustomerIdintegerコースお客様オブジェクトID。支払いがコースに関連する場合に必須です。
entitystringエンティティタイプ。使用可能な値:appointment(予約)、event(イベント)、packageコース
dateTimestring支払いが実行された、または実行される予定の日時(オンライン支払い方法の場合は現在、当日払いの場合は予約日時)。形式:YYYY-MM-DD HH:mm
gatewayTitlestringWooCommerceを使用している場合の特定のゲートウェイタイトル。例:Stripe、代金引換、銀行振込
actionsCompletedboolean予約後のアクションが完了したかどうか。
wcOrderIdintegerWooCommerce注文ID。
transactionIdstringオンラインゲートウェイの取引ID。WooCommerceを使用していない場合の払い戻しアクションに使用されます。

リクエスト
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/payments/280' \
--data '{
"customerBookingId": 268,
"amount": 15,
"dateTime": "2023-05-05 15:00:00",
"status": "paid",
"gateway": "stripe",
"gatewayTitle": null,
"data": null,
"packageCustomerId": null,
"entity": "appointment",
"actionsCompleted": 1,
"wcOrderId": null,
"transactionId": null
}'
レスポンス
{
"message": "Payment successfully updated.",
"data": {
"payment": {
"id": null,
"customerBookingId": 268,
"packageCustomerId": null,
"parentId": null,
"amount": 15,
"gateway": "stripe",
"gatewayTitle": "",
"dateTime": "2023-05-05 15:00:00",
"status": "paid",
"data": "",
"entity": null,
"created": null,
"actionsCompleted": null,
"wcOrderId": null,
"wcOrderUrl": null,
"wcItemCouponValue": null,
"wcItemTaxValue": null
}
}
}

支払いの取得

支払い詳細を取得します。

メソッド

このエンドポイントはGETリクエストを受け付けます。

パス

/payments/{{payment_id}}

リクエスト
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/payments/312' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0'
レスポンス
{
"message": "Successfully retrieved payment.",
"data": {
"payment": {
"id": 312,
"customerBookingId": 268,
"packageCustomerId": null,
"parentId": null,
"amount": 10,
"gateway": "onSite",
"gatewayTitle": "",
"dateTime": "2023-05-05 13:00:00",
"status": "paid",
"data": "",
"entity": "appointment",
"created": "2023-05-05 11:18:32",
"actionsCompleted": null,
"wcOrderId": null,
"wcOrderUrl": null,
"wcItemCouponValue": null,
"wcItemTaxValue": null
}
}
}

複数の支払いの取得

複数の支払い詳細を取得します。

メソッド

このエンドポイントはGETリクエストを受け付けます。

パス

/payments

クエリパラメータ

以下のクエリパラメータを使用できます。

キータイプ説明
datesstring支払い結果をフィルタリングするための開始日と終了日。
pageinteger結果のページ。Amelia基本設定で上限が設定されています。

リクエスト
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/payments&page=1&dates=2023-05-05,2023-05-06' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0'
レスポンス
{
"message": "Successfully retrieved payments.",
"data": {
"payments": [
{
"id": 234,
"dateTime": "2023-05-05 11:00:00",
"bookingStart": "2023-05-05 11:00:00",
"status": "pending",
"wcOrderId": null,
"gateway": "onSite",
"gatewayTitle": "",
"name": "free service",
"customerBookingId": 196,
"packageCustomerId": null,
"amount": 0,
"providers": [
{
"id": 3,
"fullName": "Milica2 スタッフ2",
"email": "milicaemployee2@test.test"
}
],
"customerId": 11,
"serviceId": 6,
"appointmentId": 128,
"packageId": null,
"bookedPrice": 10,
"bookableName": "free service",
"customerFirstName": "Amelia",
"customerLastName": "Test",
"info": "{\"firstName\":\"Amelia\",\"lastName\":\"Test\",\"phone\":null,\"locale\":\"en_US\",\"timeZone\":\"Europe\\/Belgrade\",\"urlParams\":null}",
"customerEmail": "amelia@test.test",
"coupon": null,
"persons": 1,
"aggregatedPrice": 1,
"bookingExtrasSum": 0,
"secondaryPayments": []
},
{
"id": 260,
"dateTime": "2023-05-05 11:00:00",
"bookingStart": "2023-05-05 11:00:00",
"status": "pending",
"wcOrderId": null,
"gateway": "onSite",
"gatewayTitle": "",
"name": "milica service",
"customerBookingId": 219,
"packageCustomerId": null,
"amount": 0,
"providers": [
{
"id": 1,
"fullName": "Milica スタッフ",
"email": "kpop.lover.10000@gmail.com"
}
],
"customerId": 17,
"serviceId": 2,
"appointmentId": 144,
"packageId": null,
"bookedPrice": 100,
"bookableName": "milica service",
"customerFirstName": "Avatar",
"customerLastName": "Last Airbender",
"info": null,
"customerEmail": "suraj@atla.aang",
"coupon": null,
"persons": 1,
"aggregatedPrice": 1,
"bookingExtrasSum": 0,
"secondaryPayments": []
},
{
"id": 261,
"dateTime": "2023-05-05 11:00:00",
"bookingStart": "2023-05-05 11:00:00",
"status": "pending",
"wcOrderId": null,
"gateway": "onSite",
"gatewayTitle": "",
"name": "milica service",
"customerBookingId": 220,
"packageCustomerId": null,
"amount": 0,
"providers": [
{
"id": 1,
"fullName": "Milica スタッフ",
"email": "kpop.lover.10000@gmail.com"
}
],
"customerId": 8,
"serviceId": 2,
"appointmentId": 144,
"packageId": null,
"bookedPrice": 100,
"bookableName": "milica service",
"customerFirstName": "Kim",
"customerLastName": "KibBum",
"info": null,
"customerEmail": "key@test.test",
"coupon": null,
"persons": 1,
"aggregatedPrice": 1,
"bookingExtrasSum": 0,
"secondaryPayments": []
},
{
"id": 257,
"dateTime": "2023-05-05 12:00:00",
"bookingStart": "2023-05-05 12:00:00",
"status": "pending",
"wcOrderId": null,
"gateway": "onSite",
"gatewayTitle": "",
"name": "new service",
"customerBookingId": 216,
"packageCustomerId": null,
"amount": 0,
"providers": [
{
"id": 1,
"fullName": "Milica スタッフ",
"email": "kpop.lover.10000@gmail.com"
}
],
"customerId": 5,
"serviceId": 7,
"appointmentId": 142,
"packageId": null,
"bookedPrice": 33.44,
"bookableName": "new service",
"customerFirstName": "Milica",
"customerLastName": "Test",
"info": null,
"customerEmail": "new_customer@test.test",
"coupon": null,
"persons": 3,
"aggregatedPrice": 1,
"bookingExtrasSum": 0,
"secondaryPayments": []
},
{
"id": 258,
"dateTime": "2023-05-05 12:00:00",
"bookingStart": "2023-05-05 12:00:00",
"status": "pending",
"wcOrderId": null,
"gateway": "onSite",
"gatewayTitle": "",
"name": "new service",
"customerBookingId": 217,
"packageCustomerId": null,
"amount": 0,
"providers": [
{
"id": 1,
"fullName": "Milica スタッフ",
"email": "kpop.lover.10000@gmail.com"
}
],
"customerId": 8,
"serviceId": 7,
"appointmentId": 142,
"packageId": null,
"bookedPrice": 33.44,
"bookableName": "new service",
"customerFirstName": "Kim",
"customerLastName": "KibBum",
"info": null,
"customerEmail": "key@test.test",
"coupon": null,
"persons": 2,
"aggregatedPrice": 1,
"bookingExtrasSum": 0,
"secondaryPayments": []
},
{
"id": 312,
"dateTime": "2023-05-05 15:00:00",
"bookingStart": "2023-05-23 09:00:00",
"status": "paid",
"wcOrderId": null,
"gateway": "onSite",
"gatewayTitle": "",
"name": "amelia service",
"customerBookingId": 268,
"packageCustomerId": null,
"amount": 10,
"providers": [
{
"id": 1,
"fullName": "Milica スタッフ",
"email": "kpop.lover.10000@gmail.com"
}
],
"customerId": 2,
"serviceId": 1,
"appointmentId": 181,
"packageId": null,
"bookedPrice": 20,
"bookableName": "amelia service",
"customerFirstName": "Milica",
"customerLastName": "Snake",
"info": "{\"firstName\":\"Milica\",\"lastName\":\"Snake\",\"phone\":null,\"locale\":\"en_US\",\"timeZone\":\"Europe\\/Belgrade\",\"urlParams\":null}",
"customerEmail": "snakemilica@yahoo.com",
"coupon": null,
"persons": 1,
"aggregatedPrice": 1,
"bookingExtrasSum": 0,
"secondaryPayments": [
{
"id": 309,
"customerBookingId": 268,
"packageCustomerId": null,
"parentId": null,
"amount": 5,
"gateway": "square",
"gatewayTitle": "",
"dateTime": "2023-05-04 17:32:38",
"status": "partiallyPaid",
"data": "",
"entity": "appointment",
"created": "2023-05-04 15:32:38",
"actionsCompleted": null,
"wcOrderId": null,
"wcOrderUrl": null,
"wcItemCouponValue": null,
"wcItemTaxValue": null
}
]
}
],
"filteredCount": 6,
"totalCount": 265
}
}

取引額の取得

オンライン決済ゲートウェイから支払い取引額を取得します。

メソッド

このエンドポイントはGETリクエストを受け付けます。

パス

/payments/transaction/{{payment_id}}

リクエスト
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/payments/transaction/312' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0'
レスポンス
{
"message": "Successfully retrieved payment.",
"data": {
"payment": {
"id": 312,
"customerBookingId": 268,
"packageCustomerId": null,
"parentId": null,
"amount": 10,
"gateway": "onSite",
"gatewayTitle": "",
"dateTime": "2023-05-05 13:00:00",
"status": "paid",
"data": "",
"entity": "appointment",
"created": "2023-05-05 11:18:32",
"actionsCompleted": null,
"wcOrderId": null,
"wcOrderUrl": null,
"wcItemCouponValue": null,
"wcItemTaxValue": null
}
}
}

支払い金額の計算

特定の予約情報に基づいて支払い金額を計算します。

メソッド

このエンドポイントはPOSTリクエストを受け付けます。

パス

/payments/amount

必須プロパティ

以下のプロパティは必須です。

キータイプ説明
typestringエンティティタイプ。使用可能な値:appointment(予約)、event(イベント)、packageコース
bookingsarray予約の配列。
bookingStartstring予約の開始日時。
locationIdinteger場所ID
providerIdintegerスタッフID
serviceIdintegerサービスID
recurringarray繰り返し予約の配列。予約を繰り返す場合に必須です。

オプションのプロパティ

キータイプ説明
couponCodestring使用するクーポンのコード。

リクエスト
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/payments/amount' \
--header 'Content-Type: application/json' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0' \
--data '{
"type": "appointment",
"bookings": [
{
"extras": [
{
"extraId": 4,
"quantity": 1
}
],
"deposit": true,
"persons": 2,
"duration": 1800
}
],
"bookingStart": "2023-09-06 19:00",
"locationId": 2,
"providerId": 1,
"serviceId": 1,
"recurring": [],
"couponCode": null
}'
レスポンス
{
"message": null,
"data": {
"amount": 28,
"currency": "USD"
}
}

支払いリンクの作成

特定の予約と支払い方法の支払いリンクを作成します。

メソッド

このエンドポイントはPOSTリクエストを受け付けます。

パス

/payments/link

必須プロパティ

以下のプロパティは必須です。

キータイプ説明
dataobjecttype(予約/イベント/コース)とbookingId(予約のID)の2つのプロパティを持つオブジェクト。
paymentMethodstringリンクに使用する支払いゲートウェイ。使用可能な値:payPalstripemollierazorpaywc

オプションのプロパティ

キータイプ説明
redirectUrlstring支払い成功後にお客様をリダイレクトするURL。デフォルトはAmelia基本設定で設定されたお客様マイページのリンクです。

リクエスト
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/payments/link' \
--header 'Content-Type: application/json' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0' \
--data '{
"data": {
"type": "appointment",
"bookingId": 901
},
"paymentMethod": "payPal",
"redirectUrl": null
}'
レスポンス
{
"message": null,
"data": {
"paymentLink": "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-3D332917B6694771R&useraction=commit",
"error": null
}
}

支払いの払い戻し

オンライン支払いを払い戻しします。

メソッド

このエンドポイントはPOSTリクエストを受け付けます。

パス

/payments/refund/{{payment_id}}

リクエスト
curl --location --request POST 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/payments/refund/917' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0'
レスポンス
{
"message": "Payment successfully refunded.",
"data": {
"payment": {
"id": 917,
"customerBookingId": 901,
"packageCustomerId": null,
"parentId": null,
"amount": 13,
"gateway": "payPal",
"gatewayTitle": "",
"dateTime": "2023-08-25 10:30:50",
"status": "paid",
"data": "",
"entity": "appointment",
"created": "2023-08-24 16:59:19",
"actionsCompleted": true,
"wcOrderId": null,
"wcOrderUrl": null,
"wcItemCouponValue": null,
"wcItemTaxValue": null,
"transactionId": "PAYID-MTUIFFI1Y628646J56263609"
},
"response": {
"error": false
}
}
}

支払いの削除

支払いを削除します。

メソッド

このエンドポイントはPOSTリクエストを受け付けます。

パス

/payments/delete/{{payment_id}}

リクエスト
curl --location --request POST 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/payments/delete/313' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0'
レスポンス
{
"message": "Payment successfully deleted.",
"data": {
"payment": {
"id": 313,
"customerBookingId": 268,
"packageCustomerId": null,
"parentId": null,
"amount": 15,
"gateway": "stripe",
"gatewayTitle": "",
"dateTime": "2023-05-05 13:00:00",
"status": "paid",
"data": "",
"entity": "appointment",
"created": "2023-05-05 11:22:49",
"actionsCompleted": true,
"wcOrderId": null,
"wcOrderUrl": null,
"wcItemCouponValue": null,
"wcItemTaxValue": null
}
}
}