paidy v0.2.0 Paidy.Payment
Functions for working with payments at Paidy. Through this API you can:
- create a payment,
- capture a payment,
- update a payment,
- get a payment,
- refund a payment,
- partially refund a payment.
- close a payment.
Paidy API reference: https://paidy.com/docs/api/jp/index.html#2-
Link to this section Summary
Functions
Capture a payment
Capture a payment. Accepts Paidy API key
Update a payment
Update a payment. Accepts Paidy API key
Close a payment
Close a payment. Accepts Paidy API key
Create a payment
Create a payment. Accepts Paidy API key
Get a payment
Get a payment. Accepts Paidy API key
Refund a payment
Refund a payment. Accepts Paidy API key
Partially refund a payment
Partially refund a payment. Accepts Paidy API key
Link to this section Functions
Capture a payment.
Captures a payment that is currently pending.
Note: you can default a payment to be automatically captured by setting capture: true
in the payment create params.
Returns a {:ok, payment}
tuple.
Examples
{:ok, payment} = Paidy.Payment.capture("payment_id")
Capture a payment. Accepts Paidy API key.
Captures a payment that is currently pending.
Note: you can default a payment to be automatically captured by setting capture: true
in the payment create params.
Returns a {:ok, payment}
tuple.
Examples
{:ok, payment} = Paidy.Payment.capture("payment_id", "my_key")
Update a payment.
Updates a payment with changeable information.
Accepts the following parameters:
params
- a list of params to be updated (optional; defaults to[]
). Available parameters are:description
,metadata
,receipt_email
,fraud_details
andshipping
.
Returns a {:ok, payment}
tuple.
Examples
params = %{
description: "Changed payment"
}
{:ok, payment} = Paidy.Payment.change("payment_id", params)
Update a payment. Accepts Paidy API key.
Updates a payment with changeable information.
Accepts the following parameters:
params
- a list of params to be updated (optional; defaults to[]
). Available parameters are:description
,metadata
,receipt_email
,fraud_details
andshipping
.
Returns a {:ok, payment}
tuple.
Examples
params = %{
description: "Changed payment"
}
{:ok, payment} = Paidy.Payment.change("payment_id", params, "my_key")
Close a payment.
Closes a payment that is currently pending.
Note: you can default a payment to be automatically closed by setting close: true
in the payment create params.
Returns a {:ok, payment}
tuple.
Examples
{:ok, payment} = Paidy.Payment.close("payment_id")
Close a payment. Accepts Paidy API key.
Closes a payment that is currently pending.
Note: you can default a payment to be automatically closed by setting close: true
in the payment create params.
Returns a {:ok, payment}
tuple.
Examples
{:ok, payment} = Paidy.Payment.close("payment_id", "my_key")
Create a payment.
Creates a payment with createable information.
Accepts the following parameters:
params
- a list of params to be created (optional; defaults to[]
).
Returns a {:ok, payment}
tuple.
Examples
params = %{
amount: 12500,
shipping_address: %{
line1: "AXISビル 10F",
line2: "六本木4-22-1",
state: "港区",
city: "東京都",
zip: "106-2004"
},
order: %{
order_ref: "your_order_ref",
items: [%{
quantity: 1,
id: "PDI001",
title: "Paidyスニーカー",
description: "Paidyスニーカー",
unit_price: 12000
}],
tax: 300,
shipping: 200
},
store_name: "Paidy sample store",
buyer_data: %{
age: 29,
order_count: 1000,
ltv: 250000,
last_order_amount: 20000,
last_order_at: 20
},
description: "hoge",
token_id: "tok_foobar",
currency: "JPY",
metadata: %{}
}
{:ok, payment} = Paidy.Payment.create(params)
Create a payment. Accepts Paidy API key.
Creates a payment with createable information.
Accepts the following parameters:
params
- a list of params to be created (optional; defaults to[]
).
Returns a {:ok, payment}
tuple.
Examples
params = %{
amount: 12500,
shipping_address: %{
line1: "AXISビル 10F",
line2: "六本木4-22-1",
state: "港区",
city: "東京都",
zip: "106-2004"
},
order: %{
order_ref: "your_order_ref",
items: [%{
quantity: 1,
id: "PDI001",
title: "Paidyスニーカー",
description: "Paidyスニーカー",
unit_price: 12000
}],
tax: 300,
shipping: 200
},
store_name: "Paidy sample store",
buyer_data: %{
age: 29,
order_count: 1000,
ltv: 250000,
last_order_amount: 20000,
last_order_at: 20
},
description: "hoge",
token_id: "tok_foobar",
currency: "JPY",
metadata: %{}
}
{:ok, payment} = Paidy.Payment.create(params, "my_key")
Get a payment.
Gets a payment.
Returns a {:ok, payment}
tuple.
Examples
{:ok, payment} = Paidy.Payment.get("payment_id")
Get a payment. Accepts Paidy API key.
Gets a payment.
Returns a {:ok, payment}
tuple.
Examples
{:ok, payment} = Paidy.Payment.get("payment_id", "my_key")
Refund a payment.
Refunds a payment completely.
Note: use refund_partial
if you just want to perform a partial refund.
Returns a {:ok, payment}
tuple.
Examples
{:ok, payment} = Paidy.Payment.refund("payment_id", "capture_id")
Refund a payment. Accepts Paidy API key.
Refunds a payment completely.
Note: use refund_partial
if you just want to perform a partial refund.
Returns a {:ok, payment}
tuple.
Examples
{:ok, payment} = Paidy.Payment.refund("payment_id", "capture_id", "my_key")
Partially refund a payment.
Refunds a payment partially.
Accepts the following parameters:
amount
- amount to be refunded (required).
Returns a {:ok, payment}
tuple.
Examples
{:ok, payment} = Paidy.Payment.refund_partial("payment_id", "capture_id", 500)
Partially refund a payment. Accepts Paidy API key.
Refunds a payment partially.
Accepts the following parameters:
amount
- amount to be refunded (required).
Returns a {:ok, payment}
tuple.
Examples
{:ok, payment} = Paidy.Payment.refund_partial("payment_id", "capture_id", 500, "my_key")