Introduction
API Reference
The Payske API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.
You can use the Payske API in test mode, which does not affect your live data or interact with the banking networks. The API key you use to authenticate the request determines whether the request is live mode or test mode.
The Payske API differs for every account as we release new versions and tailor functionality. Log in to see docs customized to your version of the API, with your test key and data.
Was this section helpful?YesNo
Just getting started?
Check out our development quickstart guide.
Not a developer?
Use apps from our partners to get started with Payske and to do more with your Payske account—no code required.
Base URL
https://api.payske.com
Client libraries
Authentication
Global API key
$payske = new \Payske\PayskeClient("sk_test_4eC39HqLyjWDarjtT1zdp7dc");
Per-request API key
$ch = $payske->charges->capture(
'ch_3JwDpJ2eZvKYlo2C1Ut8JRvr',
[],
['api_key' => 'sk_test_4eC39HqLyjWDarjtT1zdp7dc']
);
Your API Key
A sample test API key is included in all the examples here, so you can test any example right away.
To test requests using your account, replace the sample API key with your actual API key or sign in.
The Payske API uses API keys to authenticate requests. You can view and manage your API keys in the Payske Dashboard.
Test mode secret keys have the prefix sk_test_
and live mode secret keys have the prefix sk_live_
. Alternatively, you can use restricted API keys for granular permissions.
Your API keys carry many privileges, so be sure to keep them secure! Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth.
Use your API key by setting it in the initial configuration of new \Payske\PayskeClient()
. The PHP library will then automatically send this key in each request.
You can also set a per-request key with an option. This is often useful for Connect applications that use multiple API keys during the lifetime of a process. Methods on the returned object reuse the same API key.
All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.
Related video: Authentication.
Was this section helpful?YesNo
Errors
The Kittn API uses the following error codes:
Error Code Meaning 400 Bad Request -- The request could not be understood by the server due to malformed syntax. 401 Unauthorized -- Your API key is wrong. 403 Forbidden -- The kitten requested is hidden for administrators only. 404 Not Found -- The specified kitten could not be found. 405 Method Not Allowed -- You tried to access a kitten with an invalid method. 406 Not Acceptable -- You requested a format that isn't JSON. 410 Gone -- The kitten requested has been removed from our servers. 418 I'm a teapot. 429 Too Many Requests -- You're requesting too many kittens! Slow down! 500 Internal Server Error -- We had a problem with our server. Try again later. 503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.
HTTP status code summary
HTTP status code Description 200 - OK Everything worked as expected. 400 - Bad Request The request was unacceptable, often due to missing a required parameter. 401 - Unauthorized No valid API key provided. 402 - Request Failed The parameters were valid but the request failed. 403 - Forbidden The API key doesn't have permissions to perform the request. 404 - Not Found The requested resource doesn't exist. 409 - Conflict The request conflicts with another request (perhaps due to using the same idempotent key). 429 - Too Many Requests Too many requests hit the API too quickly. We recommend an exponential backoff of your requests. 500, 502, 503, 504 - Server Errors Something went wrong on Payske's end. (These are rare.)
Error types:
Type Description api_error API errors cover any other type of problem (e.g., a temporary problem with Payske's servers), and are extremely uncommon. card_error Card errors are the most common type of error you should expect to handle. They result when the user enters a card that can't be charged for some reason. idempotency_error Idempotency errors occur when an Idempotency-Key
is re-used on a request that does not match the first request's API endpoint and parameters.invalid_request_error Invalid request errors arise when your request has invalid parameters.
Payske uses conventional HTTP response codes to indicate the success or failure of an API request. In general: Codes in the 2xx
range indicate success. Codes in the 4xx
range indicate an error that failed given the information provided (e.g., a required parameter was omitted, a charge failed, etc.). Codes in the 5xx
range indicate an error with Payske's servers (these are rare).
Some 4xx
errors that could be handled programmatically (e.g., a card is declined) include an error code that briefly explains the error reported.
Was this section helpful?YesNo
Attributes
type : string
The type of error returned. One of
api_error
,card_error
,idempotency_error
, orinvalid_request_error
code : string
For some errors that could be handled programmatically, a short string indicating the error code reported.
decline_code : string
For card errors resulting from a card issuer decline, a short string indicating the card issuer’s reason for the decline if they provide one.
message string
A human-readable message providing more details about the error. For card errors, these messages can be shown to your users.
param string
If the error is parameter-specific, the parameter related to the error. For example, you can use this to display a message near the correct form field.
payment_intent hash
The PaymentIntent object for errors returned on a request involving a PaymentIntent.
Show child attributes
More attributesCollapse all
charge:
string
For card errors, the ID of the failed charge.
doc_url
string
A URL to more information about the error code reported.
payment_method
hash
The PaymentMethod object for errors returned on a request involving a PaymentMethod.
Show child attributes
payment_method_type
string
If the error is specific to the type of payment method, the payment method type that had a problem. This field is only populated for invoice-related errors.
setup_intent
hash
The SetupIntent object for errors returned on a request involving a SetupIntent.
Show child attributes
source
hash
The source object for errors returned on a request involving a source.
Handling errors
# Select a client library to see examples of handling different kinds of errors.
try {
// Use Payske's library to make requests...
} catch(\Payske\Exception\CardException $e) {
// Since it's a decline, \Payske\Exception\CardException will be caught
echo 'Status is:' . $e->getHttpStatus() . '\n';
echo 'Type is:' . $e->getError()->type . '\n';
echo 'Code is:' . $e->getError()->code . '\n';
// param is '' in this case
echo 'Param is:' . $e->getError()->param . '\n';
echo 'Message is:' . $e->getError()->message . '\n';
} catch (\Payske\Exception\RateLimitException $e) {
// Too many requests made to the API too quickly
} catch (\Payske\Exception\InvalidRequestException $e) {
// Invalid parameters were supplied to Payske's API
} catch (\Payske\Exception\AuthenticationException $e) {
// Authentication with Payske's API failed
// (maybe you changed API keys recently)
} catch (\Payske\Exception\ApiConnectionException $e) {
// Network communication with Payske failed
} catch (\Payske\Exception\ApiErrorException $e) {
// Display a very generic error to the user, and maybe send
// yourself an email
} catch (Exception $e) {
// Something else happened, completely unrelated to Payske
}
begin
# Use Payske's library to make requests...
rescue Payske::CardError => e
puts "Status is: #{e.http_status}"
puts "Type is: #{e.error.type}"
puts "Charge ID is: #{e.error.charge}"
# The following fields are optional
puts "Code is: #{e.error.code}" if e.error.code
puts "Decline code is: #{e.error.decline_code}" if e.error.decline_code
puts "Param is: #{e.error.param}" if e.error.param
puts "Message is: #{e.error.message}" if e.error.message
rescue Payske::RateLimitError => e
# Too many requests made to the API too quickly
rescue Payske::InvalidRequestError => e
# Invalid parameters were supplied to Payske's API
rescue Payske::AuthenticationError => e
# Authentication with Payske's API failed
# (maybe you changed API keys recently)
rescue Payske::APIConnectionError => e
# Network communication with Payske failed
rescue Payske::PayskeError => e
# Display a very generic error to the user, and maybe send
# yourself an email
rescue => e
# Something else happened, completely unrelated to Payske
end
try:
# Use Payske's library to make requests...
pass
except payske.error.CardError as e:
# Since it's a decline, payske.error.CardError will be caught
print('Status is: %s' % e.http_status)
print('Code is: %s' % e.code)
# param is '' in this case
print('Param is: %s' % e.param)
print('Message is: %s' % e.user_message)
except payske.error.RateLimitError as e:
# Too many requests made to the API too quickly
pass
except payske.error.InvalidRequestError as e:
# Invalid parameters were supplied to Payske's API
pass
except payske.error.AuthenticationError as e:
# Authentication with Payske's API failed
# (maybe you changed API keys recently)
pass
except payske.error.APIConnectionError as e:
# Network communication with Payske failed
pass
except payske.error.PayskeError as e:
# Display a very generic error to the user, and maybe send
# yourself an email
pass
except Exception as e:
# Something else happened, completely unrelated to Payske
pass
try {
// Use Payske's library to make requests...
} catch (CardException e) {
// Since it's a decline, CardException will be caught
System.out.println("Status is: " + e.getCode());
System.out.println("Message is: " + e.getMessage());
} catch (RateLimitException e) {
// Too many requests made to the API too quickly
} catch (InvalidRequestException e) {
// Invalid parameters were supplied to Payske's API
} catch (AuthenticationException e) {
// Authentication with Payske's API failed
// (maybe you changed API keys recently)
} catch (APIConnectionException e) {
// Network communication with Payske failed
} catch (PayskeException e) {
// Display a very generic error to the user, and maybe send
// yourself an email
} catch (Exception e) {
// Something else happened, completely unrelated to Payske
}
// Note: Node.js API does not throw exceptions, and instead prefers the
// asynchronous style of error handling described below.
//
// An error from the Payske API or an otherwise asynchronous error
// will be available as the first argument of any Payske method's callback:
// E.g. payske.customers.create({...}, function(err, result) {});
//
// Or in the form of a rejected promise.
// E.g. payske.customers.create({...}).then(
// function(result) {},
// function(err) {}
// );
switch (err.type) {
case 'PayskeCardError':
// A declined card error
err.message; // => e.g. "Your card's expiration year is invalid."
break;
case 'PayskeRateLimitError':
// Too many requests made to the API too quickly
break;
case 'PayskeInvalidRequestError':
// Invalid parameters were supplied to Payske's API
break;
case 'PayskeAPIError':
// An error occurred internally with Payske's API
break;
case 'PayskeConnectionError':
// Some kind of error occurred during the HTTPS communication
break;
case 'PayskeAuthenticationError':
// You probably used an incorrect API key
break;
default:
// Handle any other types of unexpected errors
break;
}
_, err := // Go library call
if err != nil {
// Try to safely cast a generic error to a payske.Error so that we can get at
// some additional Payske-specific information about what went wrong.
if payskeErr, ok := err.(*payske.Error); ok {
// The Code field will contain a basic identifier for the failure.
switch payskeErr.Code {
case payske.ErrorCodeCardDeclined:
case payske.ErrorCodeExpiredCard:
case payske.ErrorCodeIncorrectCVC:
case payske.ErrorCodeIncorrectZip:
// etc.
}
// The Err field can be coerced to a more specific error type with a type
// assertion. This technique can be used to get more specialized
// information for certain errors.
if cardErr, ok := payskeErr.Err.(*payske.CardError); ok {
fmt.Printf("Card was declined with code: %v\n", cardErr.DeclineCode)
} else {
fmt.Printf("Other Payske error occurred: %v\n", payskeErr.Error())
}
} else {
fmt.Printf("Other error occurred: %v\n", err.Error())
}
}
try {
// Use Payske's library to make request
} catch (PayskeException e) {
switch (e.PayskeError.Type)
{
case "card_error":
Console.WriteLine("Code: " + e.PayskeError.Code);
Console.WriteLine("Message: " + e.PayskeError.Message);
break;
case "api_connection_error":
break;
case "api_error":
break;
case "authentication_error":
break;
case "invalid_request_error":
break;
case "rate_limit_error":
break;
case "validation_error":
break;
default:
// Unknown Error Type
break;
}
}
Our Client libraries raise exceptions for many reasons, such as a failed charge, invalid parameters, authentication errors, and network unavailability. We recommend writing code that gracefully handles all possible API exceptions.
Related guide: Error Handling.
Core Resources
Authorization: meowmeowmeow
Charges
To charge a credit or a debit card, you create a Charge
object. You can retrieve and refund individual charges as well as list all charges. Charges are identified by a unique, random ID.
Related guide: Accept a payment with the Charges API.
Was this section helpful?YesNo
The charge object
The charge object
{
"id": "ch_3JwPVP2eZvKYlo2C1TaDkcSv",
"object": "charge",
"amount": 100,
"amount_captured": 0,
"amount_refunded": 0,
"application": null,
"application_fee": null,
"application_fee_amount": null,
"balance_transaction": "txn_1032HU2eZvKYlo2CEPtcnUvl",
"billing_details": {
"address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": null,
"name": "Jenny Rosen",
"phone": null
},
"calculated_statement_descriptor": null,
"captured": false,
"created": 1637060835,
"currency": "usd",
"customer": null,
"description": "My First Test Charge (created for API docs)",
"disputed": false,
"failure_code": null,
"failure_message": null,
"fraud_details": {},
"invoice": null,
"livemode": false,
"metadata": {},
"on_behalf_of": null,
"order": null,
"outcome": null,
"paid": true,
"payment_intent": null,
"payment_method": "card_19yUNL2eZvKYlo2CNGsN6EWH",
"payment_method_details": {
"card": {
"brand": "visa",
"checks": {
"address_line1_check": null,
"address_postal_code_check": null,
"cvc_check": "unchecked"
},
"country": "US",
"exp_month": 12,
"exp_year": 2020,
"fingerprint": "Xt5EWLLDS7FJjR1c",
"funding": "credit",
"installments": null,
"last4": "4242",
"network": "visa",
"three_d_secure": null,
"wallet": null
},
"type": "card"
},
"receipt_email": null,
"receipt_number": null,
"receipt_url": "https://pay.payske.com/receipts/acct_1032D82eZvKYlo2C/ch_3JwPVP2eZvKYlo2C1TaDkcSv/rcpt_KbckqQmcfNnj7YmFkMoUXAYkOX4hUJj",
"refunded": false,
"refunds": {
"object": "list",
"data": [],
"has_more": false,
"url": "/v1/charges/ch_3JwPVP2eZvKYlo2C1TaDkcSv/refunds"
},
"review": null,
"shipping": null,
"source_transfer": null,
"statement_descriptor": null,
"statement_descriptor_suffix": null,
"status": "succeeded",
"transfer_data": null,
"transfer_group": null
}
Attributes
id string
Unique identifier for the object.
amount positive integer or zero
Amount intended to be collected by this payment. A positive integer representing how much to charge in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or equivalent in charge currency. The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99).
balance_transaction string
ID of the balance transaction that describes the impact of this charge on your account balance (not including refunds or disputes).
billing_details hash
Billing information associated with the payment method at the time of the transaction.
Show child attributes
currency currency
Three-letter ISO currency code, in lowercase. Must be a supported currency.
customer string
ID of the customer this charge is for if one exists.
description string
An arbitrary string attached to the object. Often useful for displaying to users.
disputed boolean
Whether the charge has been disputed.
invoice string
ID of the invoice this charge is for if one exists.
metadata hash
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
payment_intent string
ID of the PaymentIntent associated with this charge, if one exists.
payment_method_details hash
Details about the payment method at the time of the transaction.
Show child attributes
receipt_email string
This is the email address that the receipt for this charge was sent to.
refunded boolean
Whether the charge has been fully refunded. If the charge is only partially refunded, this attribute will still be false.
shipping hash
Shipping information for the charge.
Show child attributes
statement_descriptor string
For card charges, use
statement_descriptor_suffix
instead. Otherwise, you can use this value as the complete description of a charge on your customers’ statements. Must contain at least one letter, maximum 22 characters.statement_descriptor_suffix string
Provides information about the charge that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that’s set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor.
status string
The status of the payment is either
succeeded
,pending
, orfailed
.
More attributesCollapse all
object string, value is "charge"
String representing the object’s type. Objects of the same type share the same value.
amount_captured positive integer or zero
Amount in cents captured (can be less than the amount attribute on the charge if a partial capture was made).
amount_refunded positive integer or zero
Amount in cents refunded (can be less than the amount attribute on the charge if a partial refund was issued).
application string
expandable "application"
Connect only
ID of the Connect application that created the charge.
calculated_statement_descriptor string
The full statement descriptor that is passed to card networks, and that is displayed on your customers’ credit card and bank statements. Allows you to see what the statement descriptor looks like after the static and dynamic portions are combined.
captured boolean
If the charge was created without capturing, this Boolean represents whether it is still uncaptured or has since been captured.
created timestamp
Time at which the object was created. Measured in seconds since the Unix epoch.
failure_code string
Error code explaining reason for charge failure if available (see the errors section for a list of codes).
failure_message string
Message to user further explaining reason for charge failure if available.
fraud_details hash
Information on fraud assessments for the charge.
Show child attributes
livemode boolean
Has the value
true
if the object exists in live mode or the valuefalse
if the object exists in test mode.
order string
ID of the order this charge is for if one exists.
outcome hash
Details about whether the payment was accepted, and why. See understanding declines for details.
Show child attributes
paid boolean
true
if the charge succeeded, or was successfully authorized for later capture.payment_method string
ID of the payment method used in this charge.
receipt_number string
This is the transaction number that appears on email receipts sent for this charge. This attribute will be
null
until a receipt has been sent.receipt_url string
This is the URL to view the receipt for this charge. The receipt is kept up-to-date to the latest state of the charge, including any refunds. If the charge is for an Invoice, the receipt will be stylized as an Invoice receipt.
refunds list
A list of refunds that have been applied to the charge.
Show child attributes
review string
ID of the review associated with this charge if one exists.
Create a charge
POST /v1/charges
# `source` is obtained with Payske.js; see https://payske.com/docs/payments/accept-a-payment-charges#web-create-token
curl https://api.payske.com/v1/charges \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d amount=2000 \
-d currency=usd \
-d source=tok_mastercard \
-d description="My First Test Charge (created for API docs)"
$payske = new \Payske\PayskeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$payske->charges->create([
'amount' => 2000,
'currency' => 'usd',
'source' => 'tok_mastercard',
'description' => 'My First Test Charge (created for API docs)',
]);
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
# `source` is obtained with Payske.js; see https://payske.com/docs/payments/accept-a-payment-charges#web-create-token
Payske::Charge.create({
amount: 2000,
currency: 'usd',
source: 'tok_visa',
description: 'My First Test Charge (created for API docs)',
})
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
# `source` is obtained with Payske.js; see https://payske.com/docs/payments/accept-a-payment-charges#web-create-token
payske.Charge.create(
amount=2000,
currency="usd",
source="tok_amex",
description="My First Test Charge (created for API docs)",
)
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
// `source` is obtained with Payske.js; see https://payske.com/docs/payments/accept-a-payment-charges#web-create-token
Map<String, Object> params = new HashMap<>();
params.put("amount", 2000);
params.put("currency", "usd");
params.put("source", "tok_visa");
params.put(
"description",
"My First Test Charge (created for API docs)"
);
Charge charge = Charge.create(params);
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
// `source` is obtained with Payske.js; see https://payske.com/docs/payments/accept-a-payment-charges#web-create-token
const charge = await payske.charges.create({
amount: 2000,
currency: 'usd',
source: 'tok_mastercard',
description: 'My First Test Charge (created for API docs)',
});
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
// `source` is obtained with Payske.js; see https://payske.com/docs/payments/accept-a-payment-charges#web-create-token
params := &payske.ChargeParams{
Amount: payske.Int64(2000),
Currency: payske.String(string(payske.CurrencyUSD)),
Description: payske.String("My First Test Charge (created for API docs)"),
Source: &payske.SourceParams{Token: payske.String("tok_amex")},
}
c, _ := charge.New(params)
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
// `source` is obtained with Payske.js; see https://payske.com/docs/payments/accept-a-payment-charges#web-create-token
var options = new ChargeCreateOptions
{
Amount = 2000,
Currency = "usd",
Source = "tok_mastercard",
Description = "My First Test Charge (created for API docs)",
};
var service = new ChargeService();
service.Create(options);
Response
{
"id": "ch_3JwRFc2eZvKYlo2C0zD9agb3",
"object": "charge",
"amount": 2000,
"amount_captured": 0,
"amount_refunded": 0,
"application": null,
"application_fee": null,
"application_fee_amount": null,
"balance_transaction": "txn_1032HU2eZvKYlo2CEPtcnUvl",
"billing_details": {
"address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": null,
"name": "Jenny Rosen",
"phone": null
},
"calculated_statement_descriptor": null,
"captured": false,
"created": 1637067544,
"currency": "usd",
"customer": null,
"description": "My First Test Charge (created for API docs)",
"disputed": false,
"failure_code": null,
"failure_message": null,
"fraud_details": {},
"invoice": null,
"livemode": false,
"metadata": {},
"on_behalf_of": null,
"order": null,
"outcome": null,
"paid": true,
"payment_intent": null,
"payment_method": "card_19yUNL2eZvKYlo2CNGsN6EWH",
"payment_method_details": {
"card": {
"brand": "visa",
"checks": {
"address_line1_check": null,
"address_postal_code_check": null,
"cvc_check": "unchecked"
},
"country": "US",
"exp_month": 12,
"exp_year": 2020,
"fingerprint": "Xt5EWLLDS7FJjR1c",
"funding": "credit",
"installments": null,
"last4": "4242",
"network": "visa",
"three_d_secure": null,
"wallet": null
},
"type": "card"
},
"receipt_email": null,
"receipt_number": null,
"receipt_url": "https://pay.payske.com/receipts/acct_1032D82eZvKYlo2C/ch_3JwRFc2eZvKYlo2C0zD9agb3/rcpt_KbeYCzGc3dPHaCuLoK8TsVSXg7b3wVW",
"refunded": false,
"refunds": {
"object": "list",
"data": [],
"has_more": false,
"url": "/v1/charges/ch_3JwRFc2eZvKYlo2C0zD9agb3/refunds"
},
"review": null,
"shipping": null,
"source_transfer": null,
"statement_descriptor": null,
"statement_descriptor_suffix": null,
"status": "succeeded",
"transfer_data": null,
"transfer_group": null,
"source": "tok_amex"
}
To charge a credit card or other payment source, you create a Charge
object. If your API key is in test mode, the supplied payment source (e.g., card) won’t actually be charged, although everything else will occur as if in live mode. (Payske assumes that the charge would have completed successfully).
Parameters
amount required
Amount intended to be collected by this payment. A positive integer representing how much to charge in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or equivalent in charge currency. The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99).
currency required
Three-letter ISO currency code, in lowercase. Must be a supported currency.
customer optional
The ID of an existing customer that will be charged in this request.
description optional
An arbitrary string which you can attach to a
Charge
object. It is displayed when in the web interface alongside the charge. Note that if you use Payske to send automatic email receipts to your customers, your receipt emails will include thedescription
of the charge(s) that they are describing.metadata optional associative array
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to
metadata
.receipt_email optional
The email address to which this charge’s receipt will be sent. The receipt will not be sent until the charge is paid, and no receipts will be sent for test mode charges. If this charge is for a Customer, the email address specified here will override the customer’s email address. If
receipt_email
is specified for a charge in live mode, a receipt will be sent regardless of your email settings.shipping optional associative array
Shipping information for the charge. Helps prevent fraud on charges for physical goods.
Show child parameters
source optional
A payment source to be charged. This can be the ID of a card (i.e., credit or debit card), a bank account, a source, a token, or a connected account. For certain sources—namely, cards, bank accounts, and attached sources—you must also pass the ID of the associated customer.
statement_descriptor optional
For card charges, use
statement_descriptor_suffix
instead. Otherwise, you can use this value as the complete description of a charge on your customers’ statements. Must contain at least one letter, maximum 22 characters.statement_descriptor_suffix optional
Provides information about the charge that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that’s set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor.
More parametersCollapse all
capture optional
Whether to immediately capture the charge. Defaults to
true
. Whenfalse
, the charge issues an authorization (or pre-authorization), and will need to be captured later. Uncaptured charges expire after a set number of days (7 by default). For more information, see the authorizing charges and settling later documentation.
Returns
Returns the charge object if the charge succeeded. This call will throw an error if something goes wrong. A common source of error is an invalid or expired card, or a valid card with insufficient available balance.
Verification responses
If the cvc
parameter is provided, Payske will attempt to check the correctness of the CVC, and will return this check's result. Similarly, if address_line1
or address_zip
are provided, Payske will try to check the validity of those parameters.
Some card issuers do not support checking one or more of these parameters, in which case Payske will return an unavailable
result.
Also note that, depending on the card issuer, charges can succeed even when passed incorrect CVC and address information.
CVC payment_method_details.card.checks.cvc_check
pass | The CVC provided is correct. |
fail | The CVC provided is incorrect. |
unavailable | The customer's card issuer did not check the CVC provided. |
unchecked | The CVC was provided but hasn't been checked yet. Checks are typically performed when attaching a card to a Customer object, or when creating a charge. For more details, see Check if a card is valid without a charge. |
Address line payment_method_details.card.checks.address_line1_check
pass | The first address line provided is correct. |
fail | The first address line provided is incorrect. |
unavailable | The customer's card issuer did not check the first address line provided. |
unchecked | The first address line was provided but hasn't been checked yet. Checks are typically performed when attaching a card to a Customer object, or when creating a charge. For more details, see Check if a card is valid without a charge. |
Address ZIP payment_method_details.card.checks.address_zip_check
pass | The ZIP code provided is correct. |
fail | The ZIP code provided is incorrect. |
unavailable | The customer's card issuer did not check the ZIP code. |
unchecked | The ZIP code was provided but hasn't been checked yet. Checks are typically performed when attaching a card to a Customer object, or when creating a charge. For more details, see Check if a card is valid without a charge. |
Retrieve a charge
GET /v1/charges/:id
curl https://api.payske.com/v1/charges/ch_3JwRFp2eZvKYlo2C0KiI8eEP \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc:
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Charge.retrieve(
'ch_3JwRMJ2eZvKYlo2C1tf0y5IY',
)
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Charge.retrieve(
"ch_3JwRMl2eZvKYlo2C0YOAvqAr",
)
$payske = new \Payske\PayskeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$payske->charges->retrieve(
'ch_3JwRNG2eZvKYlo2C07PwDCbQ',
[]
);
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Charge charge =
Charge.retrieve("ch_3JwRNf2eZvKYlo2C1E60srVy");
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const charge = await payske.charges.retrieve(
'ch_3JwRO22eZvKYlo2C1pprtk0S'
);
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
c, _ := charge.Get(
"ch_3JwRP32eZvKYlo2C1eIYPv3p",
nil,
)
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var service = new ChargeService();
service.Get("ch_3JwRFc2eZvKYlo2C0zD9agb3");
Response
{
"id": "ch_3JwRFc2eZvKYlo2C0zD9agb3",
"object": "charge",
"amount": 100,
"amount_captured": 0,
"amount_refunded": 0,
"application": null,
"application_fee": null,
"application_fee_amount": null,
"balance_transaction": "txn_1032HU2eZvKYlo2CEPtcnUvl",
"billing_details": {
"address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": null,
"name": "Jenny Rosen",
"phone": null
},
"calculated_statement_descriptor": null,
"captured": false,
"created": 1637067544,
"currency": "usd",
"customer": null,
"description": "My First Test Charge (created for API docs)",
"disputed": false,
"failure_code": null,
"failure_message": null,
"fraud_details": {},
"invoice": null,
"livemode": false,
"metadata": {},
"on_behalf_of": null,
"order": null,
"outcome": null,
"paid": true,
"payment_intent": null,
"payment_method": "card_19yUNL2eZvKYlo2CNGsN6EWH",
"payment_method_details": {
"card": {
"brand": "visa",
"checks": {
"address_line1_check": null,
"address_postal_code_check": null,
"cvc_check": "unchecked"
},
"country": "US",
"exp_month": 12,
"exp_year": 2020,
"fingerprint": "Xt5EWLLDS7FJjR1c",
"funding": "credit",
"installments": null,
"last4": "4242",
"network": "visa",
"three_d_secure": null,
"wallet": null
},
"type": "card"
},
"receipt_email": null,
"receipt_number": null,
"receipt_url": "https://pay.payske.com/receipts/acct_1032D82eZvKYlo2C/ch_3JwRFc2eZvKYlo2C0zD9agb3/rcpt_KbeYCzGc3dPHaCuLoK8TsVSXg7b3wVW",
"refunded": false,
"refunds": {
"object": "list",
"data": [],
"has_more": false,
"url": "/v1/charges/ch_3JwRFc2eZvKYlo2C0zD9agb3/refunds"
},
"review": null,
"shipping": null,
"source_transfer": null,
"statement_descriptor": null,
"statement_descriptor_suffix": null,
"status": "succeeded",
"transfer_data": null,
"transfer_group": null
}
Retrieves the details of a charge that has previously been created. Supply the unique charge ID that was returned from your previous request, and Payske will return the corresponding charge information. The same information is returned when creating or refunding the charge.
Parameters
No parameters.
Returns
Returns a charge if a valid identifier was provided, and throws an error otherwise.
Update a charge
POST /v1/charges/:id
curl https://api.payske.com/v1/charges/ch_3JwR0o2eZvKYlo2C0H9Yk2mB \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d "metadata[order_id]"=6735
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Charge.update(
'ch_3JwRWR2eZvKYlo2C0czCivpw',
{metadata: {order_id: '6735'}},
)
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Charge.modify(
"ch_3JwRWp2eZvKYlo2C0qnwD72c",
metadata={"order_id": "6735"},
)
$payske = new \Payske\PayskeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$payske->charges->update(
'ch_3JwRXD2eZvKYlo2C0rYiUbE3',
['metadata' => ['order_id' => '6735']]
);
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Charge charge =
Charge.retrieve("ch_3JwRXZ2eZvKYlo2C1tVBZbhd");
Map<String, Object> metadata = new HashMap<>();
metadata.put("order_id", "6735");
Map<String, Object> params = new HashMap<>();
params.put("metadata", metadata);
Charge updatedCharge = charge.update(params);
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const charge = await payske.charges.update(
'ch_3JwRXx2eZvKYlo2C0aoxADAV',
{metadata: {order_id: '6735'}}
);
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.ChargeParams{}
params.AddMetadata("order_id", "6735")
c, _ := charge.Update(
"ch_3JwRYn2eZvKYlo2C18JrMOJ1",
params,
)
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new ChargeUpdateOptions
{
Metadata = new Dictionary<string, string>
{
{ "order_id", "6735" },
},
};
var service = new ChargeService();
service.Update(
"ch_3JwRZH2eZvKYlo2C1rS58zMi",
options
);
Response
{
"id": "ch_3JwRP32eZvKYlo2C1eIYPv3p",
"object": "charge",
"amount": 100,
"amount_captured": 0,
"amount_refunded": 0,
"application": null,
"application_fee": null,
"application_fee_amount": null,
"balance_transaction": "txn_1032HU2eZvKYlo2CEPtcnUvl",
"billing_details": {
"address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": null,
"name": "Jenny Rosen",
"phone": null
},
"calculated_statement_descriptor": null,
"captured": false,
"created": 1637068129,
"currency": "usd",
"customer": null,
"description": "My First Test Charge (created for API docs)",
"disputed": false,
"failure_code": null,
"failure_message": null,
"fraud_details": {},
"invoice": null,
"livemode": false,
"metadata": {
"order_id": "6735"
},
"on_behalf_of": null,
"order": null,
"outcome": null,
"paid": true,
"payment_intent": null,
"payment_method": "card_19yUNL2eZvKYlo2CNGsN6EWH",
"payment_method_details": {
"card": {
"brand": "visa",
"checks": {
"address_line1_check": null,
"address_postal_code_check": null,
"cvc_check": "unchecked"
},
"country": "US",
"exp_month": 12,
"exp_year": 2020,
"fingerprint": "Xt5EWLLDS7FJjR1c",
"funding": "credit",
"installments": null,
"last4": "4242",
"network": "visa",
"three_d_secure": null,
"wallet": null
},
"type": "card"
},
"receipt_email": null,
"receipt_number": null,
"receipt_url": "https://pay.payske.com/receipts/acct_1032D82eZvKYlo2C/ch_3JwRP32eZvKYlo2C1eIYPv3p/rcpt_KbeiEa9wdyA1m0RhrX7mK0pAhwYgvVF",
"refunded": false,
"refunds": {
"object": "list",
"data": [],
"has_more": false,
"url": "/v1/charges/ch_3JwRP32eZvKYlo2C1eIYPv3p/refunds"
},
"review": null,
"shipping": null,
"source_transfer": null,
"statement_descriptor": null,
"statement_descriptor_suffix": null,
"status": "succeeded",
"transfer_data": null,
"transfer_group": null
}
Updates the specified charge by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
Parameters
customer optional
The ID of an existing customer that will be associated with this request. This field may only be updated if there is no existing associated customer with this charge.
description optional
An arbitrary string which you can attach to a charge object. It is displayed when in the web interface alongside the charge. Note that if you use Payske to send automatic email receipts to your customers, your receipt emails will include the
description
of the charge(s) that they are describing.metadata optional map
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to
metadata
.receipt_email optional
This is the email address that the receipt for this charge will be sent to. If this field is updated, then a new email receipt will be sent to the updated address.
shipping optional map
Shipping information for the charge. Helps prevent fraud on charges for physical goods.
Show child parameters
More parametersCollapse all
fraud_details optional map
A set of key-value pairs you can attach to a charge giving information about its riskiness. If you believe a charge is fraudulent, include a
user_report
key with a value offraudulent
. If you believe a charge is safe, include auser_report
key with a value ofsafe
. Payske will use the information you send to improve our fraud detection algorithms.Show child parameters
Returns
Returns the charge object if the update succeeded. This call will return an an error if update parameters are invalid.
Capture a charge
POST /v1/charges/:id/capture
curl https://api.payske.com/v1/charges/ch_3JwRox2eZvKYlo2C0zGTuUem/capture \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-X POST
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Charge.capture(
'ch_3JwRpV2eZvKYlo2C107WpW1r',
)
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Charge.capture(
"ch_3JwRus2eZvKYlo2C0JbFdiHA",
)
$payske = new \Payske\PayskeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$payske->charges->capture(
'ch_3JwRfK2eZvKYlo2C1niOjt6m',
[]
);
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Charge charge =
Charge.retrieve("ch_3JwRrl2eZvKYlo2C0FLQF4GQ");
Charge updatedCharge = charge.capture();
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const charge = await payske.charges.capture(
'ch_3JwRvA2eZvKYlo2C0hgR94fo'
);
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
c, _ := charge.Capture(
"ch_3JwRvH2eZvKYlo2C1zfYTkf1",
nil,
)
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var service = new ChargeService();
service.Capture("ch_3JwRZH2eZvKYlo2C1rS58zMi");
Response
{
"id": "ch_3JwRZH2eZvKYlo2C1rS58zMi",
"object": "charge",
"amount": 100,
"amount_captured": 0,
"amount_refunded": 0,
"application": null,
"application_fee": null,
"application_fee_amount": null,
"balance_transaction": "txn_1032HU2eZvKYlo2CEPtcnUvl",
"billing_details": {
"address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": null,
"name": "Jenny Rosen",
"phone": null
},
"calculated_statement_descriptor": null,
"captured": false,
"created": 1637068763,
"currency": "usd",
"customer": null,
"description": "My First Test Charge (created for API docs)",
"disputed": false,
"failure_code": null,
"failure_message": null,
"fraud_details": {},
"invoice": null,
"livemode": false,
"metadata": {},
"on_behalf_of": null,
"order": null,
"outcome": null,
"paid": true,
"payment_intent": null,
"payment_method": "card_19yUNL2eZvKYlo2CNGsN6EWH",
"payment_method_details": {
"card": {
"brand": "visa",
"checks": {
"address_line1_check": null,
"address_postal_code_check": null,
"cvc_check": "unchecked"
},
"country": "US",
"exp_month": 12,
"exp_year": 2020,
"fingerprint": "Xt5EWLLDS7FJjR1c",
"funding": "credit",
"installments": null,
"last4": "4242",
"network": "visa",
"three_d_secure": null,
"wallet": null
},
"type": "card"
},
"receipt_email": null,
"receipt_number": null,
"receipt_url": "https://pay.payske.com/receipts/acct_1032D82eZvKYlo2C/ch_3JwRZH2eZvKYlo2C1rS58zMi/rcpt_KbetCQn5fJJlJcTj2XRKrBGbXevbnL6",
"refunded": false,
"refunds": {
"object": "list",
"data": [],
"has_more": false,
"url": "/v1/charges/ch_3JwRZH2eZvKYlo2C1rS58zMi/refunds"
},
"review": null,
"shipping": null,
"source_transfer": null,
"statement_descriptor": null,
"statement_descriptor_suffix": null,
"status": "succeeded",
"transfer_data": null,
"transfer_group": null
}
Capture the payment of an existing, uncaptured, charge. This is the second half of the two-step payment flow, where first you created a charge with the capture option set to false.
Uncaptured payments expire a set number of days after they are created (7 by default). If they are not captured by that point in time, they will be marked as refunded and will no longer be capturable.
Parameters
amount optional
The amount to capture, which must be less than or equal to the original amount. Any additional amount will be automatically refunded.
receipt_email optional
The email address to send this charge’s receipt to. This will override the previously-specified email address for this charge, if one was set. Receipts will not be sent in test mode.
statement_descriptor optional
For card charges, use
statement_descriptor_suffix
instead. Otherwise, you can use this value as the complete description of a charge on your customers’ statements. Must contain at least one letter, maximum 22 characters.statement_descriptor_suffix optional
Provides information about the charge that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that’s set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor.
More parametersCollapse all
application_fee_amount optional
Connect only
An application fee amount to add on to this charge, which must be less than or equal to the original amount.
Returns
Returns the charge object, with an updated captured property (set to true). Capturing a charge will always succeed, unless the charge is already refunded, expired, captured, or an invalid capture amount is specified, in which case this method will throw an error.
List all charges
GET /v1/charges
curl https://api.payske.com/v1/charges \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d limit=3 \
-G
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Charge.list({limit: 3})
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Charge.list(limit=3)
$payske = new \Payske\PayskeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$payske->charges->all(['limit' => 3]);
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Map<String, Object> params = new HashMap<>();
params.put("limit", 3);
ChargeCollection charges = Charge.list(params);
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const charges = await payske.charges.list({
limit: 3,
});
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.ChargeListParams{}
params.Filters.AddFilter("limit", "", "3")
i := charge.List(params)
for i.Next() {
c := i.Charge()
}
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new ChargeListOptions { Limit = 3 };
var service = new ChargeService();
PayskeList<Charge> charges = service.List(
options
);
Response
{
"object": "list",
"url": "/v1/charges",
"has_more": false,
"data": [
{
"id": "ch_3JwRvl2eZvKYlo2C0EOCHQ2f",
"object": "charge",
"amount": 100,
"amount_captured": 0,
"amount_refunded": 0,
"application": null,
"application_fee": null,
"application_fee_amount": null,
"balance_transaction": "txn_1032HU2eZvKYlo2CEPtcnUvl",
"billing_details": {
"address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": null,
"name": "Jenny Rosen",
"phone": null
},
"calculated_statement_descriptor": null,
"captured": false,
"created": 1637070157,
"currency": "usd",
"customer": null,
"description": "My First Test Charge (created for API docs)",
"disputed": false,
"failure_code": null,
"failure_message": null,
"fraud_details": {},
"invoice": null,
"livemode": false,
"metadata": {},
"on_behalf_of": null,
"order": null,
"outcome": null,
"paid": true,
"payment_intent": null,
"payment_method": "card_19yUNL2eZvKYlo2CNGsN6EWH",
"payment_method_details": {
"card": {
"brand": "visa",
"checks": {
"address_line1_check": null,
"address_postal_code_check": null,
"cvc_check": "unchecked"
},
"country": "US",
"exp_month": 12,
"exp_year": 2020,
"fingerprint": "Xt5EWLLDS7FJjR1c",
"funding": "credit",
"installments": null,
"last4": "4242",
"network": "visa",
"three_d_secure": null,
"wallet": null
},
"type": "card"
},
"receipt_email": null,
"receipt_number": null,
"receipt_url": "https://pay.payske.com/receipts/acct_1032D82eZvKYlo2C/ch_3JwRvl2eZvKYlo2C0EOCHQ2f/rcpt_KbfGc9g9vMhHYreOFSi16yKoScxkdMk",
"refunded": false,
"refunds": {
"object": "list",
"data": [],
"has_more": false,
"url": "/v1/charges/ch_3JwRvl2eZvKYlo2C0EOCHQ2f/refunds"
},
"review": null,
"shipping": null,
"source_transfer": null,
"statement_descriptor": null,
"statement_descriptor_suffix": null,
"status": "succeeded",
"transfer_data": null,
"transfer_group": null
},
{...},
{...}
]
}Response
{
"object": "list",
"url": "/v1/charges",
"has_more": false,
"data": [
{
"id": "ch_3JwRvl2eZvKYlo2C0EOCHQ2f",
"object": "charge",
"amount": 100,
"amount_captured": 0,
"amount_refunded": 0,
"application": null,
"application_fee": null,
"application_fee_amount": null,
"balance_transaction": "txn_1032HU2eZvKYlo2CEPtcnUvl",
"billing_details": {
"address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": null,
"name": "Jenny Rosen",
"phone": null
},
"calculated_statement_descriptor": null,
"captured": false,
"created": 1637070157,
"currency": "usd",
"customer": null,
"description": "My First Test Charge (created for API docs)",
"disputed": false,
"failure_code": null,
"failure_message": null,
"fraud_details": {},
"invoice": null,
"livemode": false,
"metadata": {},
"on_behalf_of": null,
"order": null,
"outcome": null,
"paid": true,
"payment_intent": null,
"payment_method": "card_19yUNL2eZvKYlo2CNGsN6EWH",
"payment_method_details": {
"card": {
"brand": "visa",
"checks": {
"address_line1_check": null,
"address_postal_code_check": null,
"cvc_check": "unchecked"
},
"country": "US",
"exp_month": 12,
"exp_year": 2020,
"fingerprint": "Xt5EWLLDS7FJjR1c",
"funding": "credit",
"installments": null,
"last4": "4242",
"network": "visa",
"three_d_secure": null,
"wallet": null
},
"type": "card"
},
"receipt_email": null,
"receipt_number": null,
"receipt_url": "https://pay.payske.com/receipts/acct_1032D82eZvKYlo2C/ch_3JwRvl2eZvKYlo2C0EOCHQ2f/rcpt_KbfGc9g9vMhHYreOFSi16yKoScxkdMk",
"refunded": false,
"refunds": {
"object": "list",
"data": [],
"has_more": false,
"url": "/v1/charges/ch_3JwRvl2eZvKYlo2C0EOCHQ2f/refunds"
},
"review": null,
"shipping": null,
"source_transfer": null,
"statement_descriptor": null,
"statement_descriptor_suffix": null,
"status": "succeeded",
"transfer_data": null,
"transfer_group": null
},
{...},
{...}
]
}
Returns a list of charges you’ve previously created. The charges are returned in sorted order, with the most recent charges appearing first.
Parameters
More parametersCollapse all
created optional Dictionary
A filter on the list based on the object
created
field. The value can be a string with an integer Unix timestamp, or it can be a dictionary with the following options:Show child parameters
ending_before optional
A cursor for use in pagination.
ending_before
is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting withobj_bar
, your subsequent call can includeending_before=obj_bar
in order to fetch the previous page of the list.limit optional
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
payment_intent optional
Only return charges that were created by the PaymentIntent specified by this PaymentIntent ID.
starting_after
optional
A cursor for use in pagination.
starting_after
is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending withobj_foo
, your subsequent call can includestarting_after=obj_foo
in order to fetch the next page of the list.transfer_group optional
Connect only
Only return charges for this transfer group.
Returns
A Dictionary with a data
property that contains an array of up to limit
charges, starting after charge starting_after
. Each entry in the array is a separate charge object. If no more charges are available, the resulting array will be empty. If you provide a non-existent customer ID, this call throws an error.
Customers
Customer
objects allow you to perform recurring charges, and to track multiple charges, that are associated with the same customer. The API allows you to create, delete, and update your customers. You can retrieve individual customers as well as a list of all your customers.
Related guide: Save a card during payment.
Was this section helpful? Yes No
The customer object
The customer object
{
"id": "cus_KbfOzdKQ3UK2Fe",
"object": "customer",
"address": null,
"balance": 0,
"created": 1637070678,
"currency": "usd",
"default_source": null,
"delinquent": false,
"description": null,
"discount": null,
"email": null,
"invoice_prefix": "3D1D2FB",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": null,
"footer": null
},
"livemode": false,
"metadata": {},
"name": null,
"next_invoice_sequence": 1,
"phone": null,
"preferred_locales": [],
"shipping": null,
"tax_exempt": "none"
}
Attributes
id string
Unique identifier for the object.
address hash
The customer’s address.
Hide child attributes
address.city string
City, district, suburb, town, or village.
address.country string
Two-letter country code (ISO 3166-1 alpha-2).
address.line1 string
Address line 1 (e.g., street, PO Box, or company name).
address.line2 string
Address line 2 (e.g., apartment, suite, unit, or building).
address.postal_code string
ZIP or postal code.
address.state string
State, county, province, or region.
description string
An arbitrary string attached to the object. Often useful for displaying to users.
email string
The customer’s email address.
metadata hash
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
name string
The customer’s full name or business name.
phone string
The customer’s phone number.
shipping hash
Mailing and shipping address for the customer. Appears on invoices emailed to this customer.
Hide child attributes
shipping.address hash
Customer shipping address.
Hide child attributes
shipping.address.city string
City, district, suburb, town, or village.
shipping.address.country string
Two-letter country code (ISO 3166-1 alpha-2).
shipping.address.line1 string
Address line 1 (e.g., street, PO Box, or company name).
shipping.address.line2 string
Address line 2 (e.g., apartment, suite, unit, or building).
shipping.address.postal_code string
ZIP or postal code.
shipping.address.state string
State, county, province, or region.
shipping.name string
Customer name.
shipping.phone string
Customer phone (including extension).
More attributesCollapse all
object string, value is "customer"
String representing the object’s type. Objects of the same type share the same value.
balance integer
Current balance, if any, being stored on the customer. If negative, the customer has credit to apply to their next invoice. If positive, the customer has an amount owed that will be added to their next invoice. The balance does not refer to any unpaid invoices; it solely takes into account amounts that have yet to be successfully applied to any invoice. This balance is only taken into account as invoices are finalized.
created timestamp
Time at which the object was created. Measured in seconds since the Unix epoch.
currency string
Three-letter ISO code for the currency the customer can be charged in for recurring billing purposes.
default_source string
expandable
ID of the default payment source for the customer.
If you are using payment methods created via the PaymentMethods API, see the invoice_settings.default_payment_method field instead.
delinquent boolean
When the customer’s latest invoice is billed by charging automatically,
delinquent
istrue
if the invoice’s latest charge failed. When the customer’s latest invoice is billed by sending an invoice,delinquent
istrue
if the invoice isn’t paid by its due date.If an invoice is marked uncollectible by dunning,
delinquent
doesn’t get reset tofalse
.discount hash, discount object
Describes the current discount active on the customer, if there is one.
invoice_prefix string
The prefix for the customer used to generate unique invoice numbers.
invoice_settings hash
The customer’s default invoice settings.
Hide child attributes
invoice_settings.custom_fields array of hashes
Default custom fields to be displayed on invoices for this customer.
Hide child attributes
invoice_settings.default_payment_method string
ID of a payment method that’s attached to the customer, to be used as the customer’s default payment method for subscriptions and invoices.
invoice_settings.footer string
Default footer to be displayed on invoices for this customer.
livemode boolean
Has the value
true
if the object exists in live mode or the valuefalse
if the object exists in test mode.next_invoice_sequence integer
The suffix of the customer’s next invoice number, e.g., 0001.
preferred_locales array containing strings
The customer’s preferred locales (languages), ordered by preference.
sources list expandable
The customer’s payment sources, if any.
This field is not included by default. To include it in the response, expand the
sources
field.Show child attributes
subscriptions list expandable
The customer’s current subscriptions, if any.
This field is not included by default. To include it in the response, expand the
subscriptions
field.Show child attributes
tax hash expandable
Tax details for the customer.
This field is not included by default. To include it in the response, expand the
tax
field.Show child attributes
tax_exempt string
Describes the customer’s tax exemption status. One of
none
,exempt
, orreverse
. When set toreverse
, invoice and receipt PDFs include the text “Reverse charge”.tax_ids list expandable
The customer’s tax IDs.
This field is not included by default. To include it in the response, expand the
tax_ids
field.Show child attributes
Create a customer
POST /v1/customers
curl https://api.payske.com/v1/customers \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d description="My First Test Customer (created for API docs)"
$payske = new \Payske\PayskeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$payske->customers->create([
'description' => 'My First Test Customer (created for API docs)',
]);
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Customer.create({
description: 'My First Test Customer (created for API docs)',
})
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Customer.create(
description="My First Test Customer (created for API docs)",
)
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Map<String, Object> params = new HashMap<>();
params.put(
"description",
"My First Test Customer (created for API docs)"
);
Customer customer = Customer.create(params);
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const customer = await payske.customers.create({
description: 'My First Test Customer (created for API docs)',
});
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.CustomerParams{
Description: payske.String("My First Test Customer (created for API docs)"),
}
c, _ := customer.New(params)
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new CustomerCreateOptions
{
Description = "My First Test Customer (created for API docs)",
};
var service = new CustomerService();
service.Create(options);
Response
{
"id": "cus_KbfOzdKQ3UK2Fe",
"object": "customer",
"address": null,
"balance": 0,
"created": 1637070678,
"currency": "usd",
"default_source": null,
"delinquent": false,
"description": "My First Test Customer (created for API docs)",
"discount": null,
"email": null,
"invoice_prefix": "3D1D2FB",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": null,
"footer": null
},
"livemode": false,
"metadata": {},
"name": null,
"next_invoice_sequence": 1,
"phone": null,
"preferred_locales": [],
"shipping": null,
"tax_exempt": "none"
}
Parameters
address optional dictionary
The customer’s address.
Hide child parameters
address.city optional
City, district, suburb, town, or village.
address.country optional
Two-letter country code (ISO 3166-1 alpha-2).
address.line1 optional
Address line 1 (e.g., street, PO Box, or company name).
address.line2 optional
Address line 2 (e.g., apartment, suite, unit, or building).
address.postal_code optional
ZIP or postal code.
address.state optional
State, county, province, or region.
description optional
An arbitrary string that you can attach to a customer object. It is displayed alongside the customer in the dashboard.
email optional
Customer’s email address. It’s displayed alongside the customer in your dashboard and can be useful for searching and tracking. This may be up to 512 characters.
metadata optional dictionary
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to
metadata
.name optional
The customer’s full name or business name.
payment_method optional
The ID of the PaymentMethod to attach to the customer.
phone optional
The customer’s phone number.
shipping optional dictionary
The customer’s shipping information. Appears on invoices emailed to this customer.
Hide child parameters
shipping.address required
Customer shipping address.
Hide child parameters
shipping.address.city optional
City, district, suburb, town, or village.
shipping.address.country optional
Two-letter country code (ISO 3166-1 alpha-2).
shipping.address.line1 optional
Address line 1 (e.g., street, PO Box, or company name).
shipping.address.line2 optional
Address line 2 (e.g., apartment, suite, unit, or building).
shipping.address.postal_code optional
ZIP or postal code.
shipping.address.state optional
State, county, province, or region.
shipping.name required
Customer name.
shipping.phone optional
Customer phone (including extension).
More parametersCollapse all
balance optional
An integer amount in cents that represents the customer’s current balance, which affect the customer’s future invoices. A negative amount represents a credit that decreases the amount due on an invoice; a positive amount increases the amount due on an invoice.
coupon optional
If you provide a coupon code, the customer will have a discount applied on all recurring charges. Charges you create through the API will not have the discount.
invoice_prefix optional
The prefix for the customer used to generate unique invoice numbers. Must be 3–12 uppercase letters or numbers.
invoice_settings optional dictionary
Default invoice settings for this customer.
Hide child parameters
invoice_settings.custom_fields optional array of hashes
Default custom fields to be displayed on invoices for this customer. When updating, pass an empty string to remove previously-defined fields.
Hide child parameters
invoice_settings.default_payment_method optional
ID of a payment method that’s attached to the customer, to be used as the customer’s default payment method for subscriptions and invoices.
invoice_settings.footer optional
Default footer to be displayed on invoices for this customer.
next_invoice_sequence optional
The sequence to be used on the customer’s next invoice. Defaults to 1.
preferred_locales optional
Customer’s preferred languages, ordered by preference.
promotion_code optional
The API ID of a promotion code to apply to the customer. The customer will have a discount applied on all recurring payments. Charges you create through the API will not have the discount.
source optional
When using payment sources created via the Token or Sources APIs, passing
source
will create a new source object, make it the new customer default source, and delete the old customer default if one exists. If you want to add additional sources instead of replacing the existing default, use the card creation API. Whenever you attach a card to a customer, Payske will automatically validate the card.tax optional dictionary
Tax details about the customer.
Hide child parameters
tax.ip_address optional
A recent IP address of the customer used for tax reporting and tax location inference. Payske recommends updating the IP address when a new PaymentMethod is attached or the address field on the customer is updated. We recommend against updating this field more frequently since it could result in unexpected tax location/reporting outcomes.
tax_exempt optional
The customer’s tax exemption. One of
none
,exempt
, orreverse
.tax_id_data optional array of hashes
The customer’s tax IDs.
Hide child parameters
tax_id_data.type required
Type of the tax ID, one of
ae_trn
,au_abn
,au_arn
,br_cnpj
,br_cpf
,ca_bn
,ca_gst_hst
,ca_pst_bc
,ca_pst_mb
,ca_pst_sk
,ca_qst
,ch_vat
,cl_tin
,es_cif
,eu_vat
,gb_vat
,hk_br
,id_npwp
,il_vat
,in_gst
,jp_cn
,jp_rn
,kr_brn
,li_uid
,mx_rfc
,my_frp
,my_itn
,my_sst
,no_vat
,nz_gst
,ru_inn
,ru_kpp
,sa_vat
,sg_gst
,sg_uen
,th_vat
,tw_vat
,us_ein
, orza_vat
tax_id_data.value required
Value of the tax ID.
Returns
Returns the customer object if the update succeeded. Returns an error if create parameters are invalid (e.g. specifying an invalid coupon or an invalid source).
Retrieve a customer
GET /v1/customers/:id
curl https://api.payske.com/v1/customers/cus_AJ6yA7mRH34mJT \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc:
$payske = new \Payske\PayskeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$payske->customers->retrieve(
'cus_AJ6yA7mRH34mJT',
[]
);
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Customer.retrieve('cus_AJ6yA7mRH34mJT')
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Customer.retrieve("cus_AJ6yA7mRH34mJT")
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Customer customer =
Customer.retrieve("cus_AJ6yA7mRH34mJT");
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const customer = await payske.customers.retrieve(
'cus_AJ6yA7mRH34mJT'
);
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
c, _ := customer.Get("cus_AJ6yA7mRH34mJT", nil)
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var service = new CustomerService();
service.Get("cus_AJ6yA7mRH34mJT");
Response
{
"id": "cus_KbfOzdKQ3UK2Fe",
"object": "customer",
"address": null,
"balance": 0,
"created": 1637070678,
"currency": "usd",
"default_source": null,
"delinquent": false,
"description": null,
"discount": null,
"email": null,
"invoice_prefix": "3D1D2FB",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": null,
"footer": null
},
"livemode": false,
"metadata": {},
"name": null,
"next_invoice_sequence": 1,
"phone": null,
"preferred_locales": [],
"shipping": null,
"tax_exempt": "none"
}
Retrieves the details of an existing customer. You need only supply the unique customer identifier that was returned upon customer creation.
Parameters
No parameters.
Returns
Returns a customer object if a valid identifier was provided. When requesting the ID of a customer that has been deleted, a subset of the customer’s information will be returned, including a deleted
property, which will be true.
Update a customer
POST /v1/customers/:id
curl https://api.payske.com/v1/customers/cus_AJ6yA7mRH34mJT \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d "metadata[order_id]"=6735
$payske = new \Payske\PayskeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$payske->customers->update(
'cus_AJ6yA7mRH34mJT',
['metadata' => ['order_id' => '6735']]
);
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Customer.update(
'cus_AJ6yA7mRH34mJT',
{metadata: {order_id: '6735'}},
)
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Customer.modify(
"cus_AJ6yA7mRH34mJT",
metadata={"order_id": "6735"},
)
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Customer customer =
Customer.retrieve("cus_AJ6yA7mRH34mJT");
Map<String, Object> metadata = new HashMap<>();
metadata.put("order_id", "6735");
Map<String, Object> params = new HashMap<>();
params.put("metadata", metadata);
Customer updatedCustomer =
customer.update(params);
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const customer = await payske.customers.update(
'cus_AJ6yA7mRH34mJT',
{metadata: {order_id: '6735'}}
);
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.CustomerParams{}
params.AddMetadata("order_id", "6735")
c, _ := customer.Update(
"cus_AJ6yA7mRH34mJT",
params,
)
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new CustomerUpdateOptions
{
Metadata = new Dictionary<string, string>
{
{ "order_id", "6735" },
},
};
var service = new CustomerService();
service.Update("cus_AJ6yA7mRH34mJT", options);
Response
{
"id": "cus_KbfOzdKQ3UK2Fe",
"object": "customer",
"address": null,
"balance": 0,
"created": 1637070678,
"currency": "usd",
"default_source": null,
"delinquent": false,
"description": null,
"discount": null,
"email": null,
"invoice_prefix": "3D1D2FB",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": null,
"footer": null
},
"livemode": false,
"metadata": {
"order_id": "6735"
},
"name": null,
"next_invoice_sequence": 1,
"phone": null,
"preferred_locales": [],
"shipping": null,
"tax_exempt": "none"
}
Updates the specified customer by setting the values of the parameters passed. Any parameters not provided will be left unchanged. For example, if you pass the source parameter, that becomes the customer’s active source (e.g., a card) to be used for all charges in the future. When you update a customer to a new valid card source by passing the source parameter: for each of the customer’s current subscriptions, if the subscription bills automatically and is in the past_due
state, then the latest open invoice for the subscription with automatic collection enabled will be retried. This retry will not count as an automatic retry, and will not affect the next regularly scheduled payment for the invoice. Changing the default_source for a customer will not trigger this behavior.
This request accepts mostly the same arguments as the customer creation call.
Parameters
address optional dictionary
The customer’s address.
Hide child parameters
address.city optional
City, district, suburb, town, or village.
address.country optional
Two-letter country code (ISO 3166-1 alpha-2).
address.line1 optional
Address line 1 (e.g., street, PO Box, or company name).
address.line2 optional
Address line 2 (e.g., apartment, suite, unit, or building).
address.postal_code optional
ZIP or postal code.
address.state optional
State, county, province, or region.
description optional
An arbitrary string that you can attach to a customer object. It is displayed alongside the customer in the dashboard.
email optional
Customer’s email address. It’s displayed alongside the customer in your dashboard and can be useful for searching and tracking. This may be up to 512 characters.
metadata optional dictionary
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to
metadata
.name optional
The customer’s full name or business name.
phone optional
The customer’s phone number.
shipping optional dictionary
The customer’s shipping information. Appears on invoices emailed to this customer.
Hide child parameters
shipping.address required
Customer shipping address.
Hide child parameters
shipping.address.city optional
City, district, suburb, town, or village.
shipping.address.country optional
Two-letter country code (ISO 3166-1 alpha-2).
shipping.address.line1 optional
Address line 1 (e.g., street, PO Box, or company name).
shipping.address.line2 optional
Address line 2 (e.g., apartment, suite, unit, or building).
shipping.address.postal_code optional
ZIP or postal code.
shipping.address.state optional
State, county, province, or region.
shipping.name required
Customer name.
shipping.phone optional
Customer phone (including extension).
More parametersCollapse all
balance optional
An integer amount in cents that represents the customer’s current balance, which affect the customer’s future invoices. A negative amount represents a credit that decreases the amount due on an invoice; a positive amount increases the amount due on an invoice.
coupon optional
If you provide a coupon code, the customer will have a discount applied on all recurring charges. Charges you create through the API will not have the discount.
default_source optional
If you are using payment methods created via the PaymentMethods API, see the invoice_settings.default_payment_method parameter.
Provide the ID of a payment source already attached to this customer to make it this customer’s default payment source.
If you want to add a new payment source and make it the default, see the source property.
invoice_prefix optional
The prefix for the customer used to generate unique invoice numbers. Must be 3–12 uppercase letters or numbers.
invoice_settings optional dictionary
Default invoice settings for this customer.
Hide child parameters
invoice_settings.custom_fields optional array of hashes
Default custom fields to be displayed on invoices for this customer. When updating, pass an empty string to remove previously-defined fields.
Hide child parameters
invoice_settings.default_payment_method optional
ID of a payment method that’s attached to the customer, to be used as the customer’s default payment method for subscriptions and invoices.
invoice_settings.footer optional
Default footer to be displayed on invoices for this customer.
next_invoice_sequence optional
The sequence to be used on the customer’s next invoice. Defaults to 1.
preferred_locales optional
Customer’s preferred languages, ordered by preference.
promotion_code optional
The API ID of a promotion code to apply to the customer. The customer will have a discount applied on all recurring payments. Charges you create through the API will not have the discount.
source optional
When using payment sources created via the Token or Sources APIs, passing
source
will create a new source object, make it the new customer default source, and delete the old customer default if one exists. If you want to add additional sources instead of replacing the existing default, use the card creation API. Whenever you attach a card to a customer, Payske will automatically validate the card.tax optional dictionary
Tax details about the customer.
Hide child parameters
tax.ip_address optional
A recent IP address of the customer used for tax reporting and tax location inference. Payske recommends updating the IP address when a new PaymentMethod is attached or the address field on the customer is updated. We recommend against updating this field more frequently since it could result in unexpected tax location/reporting outcomes.
tax_exempt optional
The customer’s tax exemption. One of
none
,exempt
, orreverse
.
Returns
Returns the customer object if the update succeeded. Returns an error if update parameters are invalid (e.g. specifying an invalid coupon or an invalid source).
Delete a customer
DELETE /v1/customers/:id
curl https://api.payske.com/v1/customers/cus_KbfOzdKQ3UK2Fe \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-X DELETE
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Customer.delete('cus_AJ6yA7mRH34mJT')
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Customer.delete("cus_AJ6yA7mRH34mJT")
$payske = new \Payske\PayskeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$payske->customers->delete(
'cus_AJ6yA7mRH34mJT',
[]
);
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Customer customer =
Customer.retrieve("cus_AJ6yA7mRH34mJT");
Customer deletedCustomer = customer.delete();
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const deleted = await payske.customers.del(
'cus_AJ6yA7mRH34mJT'
);
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
c, _ := customer.Del("cus_AJ6yA7mRH34mJT", nil)
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var service = new CustomerService();
service.Delete("cus_AJ6yA7mRH34mJT");
Response
{
"id": "cus_Kc344PP3X2o0IA",
"object": "customer",
"deleted": true
}
Permanently deletes a customer. It cannot be undone. Also immediately cancels any active subscriptions on the customer.
Parameters
No parameters.
Returns
Returns an object with a deleted parameter on success. If the customer ID does not exist, this call returns an error.
Unlike other objects, deleted customers can still be retrieved through the API, in order to be able to track the history of customers while still removing their credit card details and preventing any further operations to be performed (such as adding a new subscription).
List all customers
GET /v1/customers
curl https://api.payske.com/v1/customers \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d limit=3 \
-G
$payske = new \Payske\PayskeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$payske->customers->all(['limit' => 3]);
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Customer.list({limit: 3})
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Customer.list(limit=3)
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Map<String, Object> params = new HashMap<>();
params.put("limit", 3);
CustomerCollection customers =
Customer.list(params);
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const customers = await payske.customers.list({
limit: 3,
});
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.CustomerListParams{}
params.Filters.AddFilter("limit", "", "3")
i := customer.List(params)
for i.Next() {
c := i.Customer()
}
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new CustomerListOptions
{
Limit = 3,
};
var service = new CustomerService();
PayskeList<Customer> customers = service.List(
options
);
Response
{
"object": "list",
"url": "/v1/customers",
"has_more": false,
"data": [
{
"id": "cus_Kc344PP3X2o0IA",
"object": "customer",
"address": null,
"balance": 0,
"created": 1637158746,
"currency": "usd",
"default_source": null,
"delinquent": false,
"description": null,
"discount": null,
"email": null,
"invoice_prefix": "B24281E",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": null,
"footer": null
},
"livemode": false,
"metadata": {},
"name": null,
"next_invoice_sequence": 1,
"phone": null,
"preferred_locales": [],
"shipping": null,
"tax_exempt": "none"
},
{...},
{...}
]
}
Returns a list of your customers. The customers are returned sorted by creation date, with the most recent customers appearing first.
Parameters
email optional
A case-sensitive filter on the list based on the customer’s
email
field. The value must be a string.
More parametersCollapse all
created optional dictionary
A filter on the list based on the object
created
field. The value can be a string with an integer Unix timestamp, or it can be a dictionary with the following options:Hide child parameters
created.gt optional
Return results where the
created
field is greater than this value.created.gte optional
Return results where the
created
field is greater than or equal to this value.created.lt optional
Return results where the
created
field is less than this value.created.lte optional
Return results where the
created
field is less than or equal to this value.
ending_before optional
A cursor for use in pagination.
ending_before
is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting withobj_bar
, your subsequent call can includeending_before=obj_bar
in order to fetch the previous page of the list.limit optional
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
starting_after optional
A cursor for use in pagination.
starting_after
is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending withobj_foo
, your subsequent call can includestarting_after=obj_foo
in order to fetch the next page of the list.
Returns
A dictionary with a data
property that contains an array of up to limit
customers, starting after customer starting_after
. Passing an optional email
will result in filtering to customers with only that exact email address. Each entry in the array is a separate customer object. If no more customers are available, the resulting array will be empty. This request should never return an error.
Refunds
Refund
objects allow you to refund a charge that has previously been created but not yet refunded. Funds will be refunded to the credit or debit card that was originally charged.
Related guide: Refunds.
Was this section helpful? Yes No
The refund object
The refund object
{
"id": "re_3Jwoyw2eZvKYlo2C0j0W7b25",
"object": "refund",
"amount": 100,
"balance_transaction": null,
"charge": "ch_3Jwoyw2eZvKYlo2C0rAzmt9u",
"created": 1637158767,
"currency": "usd",
"metadata": {},
"payment_intent": null,
"reason": null,
"receipt_number": null,
"source_transfer_reversal": null,
"status": "succeeded",
"transfer_reversal": null
}
Attributes
id string
Unique identifier for the object.
amount integer
Amount, in cents.
charge string
ID of the charge that was refunded.
currency currency
Three-letter ISO currency code, in lowercase. Must be a supported currency.
description string
An arbitrary string attached to the object. Often useful for displaying to users. (Available on non-card refunds only)
metadata hash
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
payment_intent string
ID of the PaymentIntent that was refunded.
reason string
Reason for the refund, either user-provided (
duplicate
,fraudulent
, orrequested_by_customer
) or generated by Payske internally (expired_uncaptured_charge
).status string
Status of the refund. For credit card refunds, this can be
pending
,succeeded
, orfailed
. For other types of refunds, it can bepending
,succeeded
,failed
, orcanceled
. Refer to our refunds documentation for more details.
More attributesCollapse all
object string, value is "refund"
String representing the object’s type. Objects of the same type share the same value.
balance_transaction string
Balance transaction that describes the impact on your account balance.
created timestamp
Time at which the object was created. Measured in seconds since the Unix epoch.
failure_balance_transaction string
If the refund failed, this balance transaction describes the adjustment made on your account balance that reverses the initial balance transaction.
failure_reason string
If the refund failed, the reason for refund failure if known. Possible values are
lost_or_stolen_card
,expired_or_canceled_card
, orunknown
.receipt_number string
This is the transaction number that appears on email receipts sent for this refund.
source_transfer_reversal string
Connect only
The transfer reversal that is associated with the refund. Only present if the charge came from another Payske account. See the Connect documentation for details.
transfer_reversal string
Connect only
If the accompanying transfer was reversed, the transfer reversal object. Only applicable if the charge was created using the destination parameter.
Create a refund
POST /v1/refunds
curl https://api.payske.com/v1/refunds \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d charge=ch_3Jwoyw2eZvKYlo2C0rAzmt9u
$payske = new \Payske\PayskeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$payske->refunds->create([
'charge' => 'ch_3Jx9xt2eZvKYlo2C1gE6In53',
]);
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Refund.create({
charge: 'ch_3JxAEM2eZvKYlo2C1pR4wQkK',
})
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Refund.create(
charge="ch_3JxAYt2eZvKYlo2C0i3NLUgg",
)
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Map<String, Object> params = new HashMap<>();
params.put(
"charge",
"ch_3JxAnQ2eZvKYlo2C0dYcNQ2j"
);
Refund refund = Refund.create(params);
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const refund = await payske.refunds.create({
charge: 'ch_3JxAxn2eZvKYlo2C0fPqYpEL',
});
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.RefundParams{
Charge: payske.String("ch_3JxB9E2eZvKYlo2C1Y7trE7d"),
}
r, _ := refund.New(params)
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new RefundCreateOptions
{
Charge = "ch_3JxX3a2eZvKYlo2C0PIuCt1c",
};
var service = new RefundService();
service.Create(options);
Response
{
"id": "re_3Jwoyw2eZvKYlo2C0j0W7b25",
"object": "refund",
"amount": 100,
"balance_transaction": null,
"charge": "ch_3Jwoyw2eZvKYlo2C0rAzmt9u",
"created": 1637158767,
"currency": "usd",
"metadata": {},
"payment_intent": null,
"reason": null,
"receipt_number": null,
"source_transfer_reversal": null,
"status": "succeeded",
"transfer_reversal": null
}
When you create a new refund, you must specify a Charge or a PaymentIntent object on which to create it.
Creating a new refund will refund a charge that has previously been created but not yet refunded. Funds will be refunded to the credit or debit card that was originally charged.
You can optionally refund only part of a charge. You can do so multiple times, until the entire charge has been refunded.
Once entirely refunded, a charge can’t be refunded again. This method will return an error when called on an already-refunded charge, or when trying to refund more money than is left on a charge.
Parameters
charge optional
The identifier of the charge to refund.
amount optional, default is entire charge
A positive integer in cents representing how much of this charge to refund. Can refund only up to the remaining, unrefunded amount of the charge.
metadata optional dictionary, default is { }
A set of key-value pairs that you can attach to a
Refund
object. This can be useful for storing additional information about the refund in a structured format. You can unset individual keys if you POST an empty value for that key. You can clear all keys if you POST an empty value formetadata
payment_intent optional
ID of the PaymentIntent to refund.
reason optional, default is null
String indicating the reason for the refund. If set, possible values are
duplicate
,fraudulent
, andrequested_by_customer
. If you believe the charge to be fraudulent, specifyingfraudulent
as the reason will add the associated card and email to your block lists, and will also help us improve our fraud detection algorithms.
Returns
Returns the Refund
object if the refund succeeded. Returns an error if the Charge/PaymentIntent has already been refunded, or if an invalid identifier was provided.
Retrieve a refund
GET /v1/refunds/:id
curl https://api.payske.com/v1/refunds/re_3Jwoyw2eZvKYlo2C0j0W7b25 \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc:
$payske = new \Payske\PayskeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$payske->refunds->retrieve(
're_3Jx9xt2eZvKYlo2C1Ue24oub',
[]
);
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Refund.retrieve(
're_3JxAEM2eZvKYlo2C1BdXHYbZ',
)
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Refund.retrieve(
"re_3JxAYt2eZvKYlo2C013QN07e",
)
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Refund refund =
Refund.retrieve("re_3JxAnQ2eZvKYlo2C0yobhsNO");
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const refund = await payske.refunds.retrieve(
're_3JxAxn2eZvKYlo2C0M0kr493'
);
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
r, _ := refund.Get(
"re_3JxB9E2eZvKYlo2C13CYbVxh",
nil,
)
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var service = new RefundService();
service.Get("re_3JxX3a2eZvKYlo2C075EWPso");
Response
{
"id": "re_3Jwoyw2eZvKYlo2C0j0W7b25",
"object": "refund",
"amount": 100,
"balance_transaction": null,
"charge": "ch_3Jwoyw2eZvKYlo2C0rAzmt9u",
"created": 1637158767,
"currency": "usd",
"metadata": {},
"payment_intent": null,
"reason": null,
"receipt_number": null,
"source_transfer_reversal": null,
"status": "succeeded",
"transfer_reversal": null
}
Retrieves the details of an existing refund.
Parameters
No parameters.
Returns
Returns a refund if a valid ID was provided. Returns an error otherwise.
Update a refund
POST /v1/refunds/:id
curl https://api.payske.com/v1/refunds/re_3Jwoyw2eZvKYlo2C0j0W7b25 \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d "metadata[order_id]"=6735
$payske = new \Payske\PayskeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$payske->refunds->update(
're_3Jx9xt2eZvKYlo2C1Ue24oub',
['metadata' => ['order_id' => '6735']]
);
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Refund.update(
're_3JxAEM2eZvKYlo2C1BdXHYbZ',
{metadata: {order_id: '6735'}},
)
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Refund.modify(
"re_3JxAYt2eZvKYlo2C013QN07e",
metadata={"order_id": "6735"},
)
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Refund refund =
Refund.retrieve("re_3JxAnQ2eZvKYlo2C0yobhsNO");
Map<String, Object> metadata = new HashMap<>();
metadata.put("order_id", "6735");
Map<String, Object> params = new HashMap<>();
params.put("metadata", metadata);
Refund updatedRefund = refund.update(params);
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const refunds = await payske.refunds.list({
limit: 3,
});
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.RefundParams{}
params.AddMetadata("order_id", "6735")
r, _ := refund.Update(
"re_3JxB9E2eZvKYlo2C13CYbVxh",
params,
)
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var service = new RefundService();
service.Get("re_3JxX3a2eZvKYlo2C075EWPso");
Response
{
"id": "re_3Jwoyw2eZvKYlo2C0j0W7b25",
"object": "refund",
"amount": 100,
"balance_transaction": null,
"charge": "ch_3Jwoyw2eZvKYlo2C0rAzmt9u",
"created": 1637158767,
"currency": "usd",
"metadata": {
"order_id": "6735"
},
"payment_intent": null,
"reason": null,
"receipt_number": null,
"source_transfer_reversal": null,
"status": "succeeded",
"transfer_reversal": null
}Response
{
"id": "re_3Jwoyw2eZvKYlo2C0j0W7b25",
"object": "refund",
"amount": 100,
"balance_transaction": null,
"charge": "ch_3Jwoyw2eZvKYlo2C0rAzmt9u",
"created": 1637158767,
"currency": "usd",
"metadata": {
"order_id": "6735"
},
"payment_intent": null,
"reason": null,
"receipt_number": null,
"source_transfer_reversal": null,
"status": "succeeded",
"transfer_reversal": null
}
Updates the specified refund by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
This request only accepts metadata
as an argument.
Parameters
metadata optional dictionary
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to
metadata
.
Returns
Returns the refund object if the update succeeded. This call will return an error if update parameters are invalid.
List all refunds
GET /v1/refunds
curl https://api.payske.com/v1/refunds \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d limit=3 \
-G
$payske = new \Payske\PayskeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$payske->refunds->all(['limit' => 3]);
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Refund.list({limit: 3})
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Refund.list(limit=3)
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Map<String, Object> params = new HashMap<>();
params.put("limit", 3);
RefundCollection refunds = Refund.list(params);
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const refunds = await payske.refunds.list({
limit: 3,
});
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.RefundListParams{}
params.Filters.AddFilter("limit", "", "3")
i := refund.List(params)
for i.Next() {
r := i.Refund()
}
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new RefundListOptions { Limit = 3 };
var service = new RefundService();
PayskeList<Refund> refunds = service.List(
options
);
Response
{
"object": "list",
"url": "/v1/refunds",
"has_more": false,
"data": [
{
"id": "re_3Jwoyw2eZvKYlo2C0j0W7b25",
"object": "refund",
"amount": 100,
"balance_transaction": null,
"charge": "ch_3Jwoyw2eZvKYlo2C0rAzmt9u",
"created": 1637158767,
"currency": "usd",
"metadata": {},
"payment_intent": null,
"reason": null,
"receipt_number": null,
"source_transfer_reversal": null,
"status": "succeeded",
"transfer_reversal": null
},
{...},
{...}
]
}
Returns a list of all refunds you’ve previously created. The refunds are returned in sorted order, with the most recent refunds appearing first. For convenience, the 10 most recent refunds are always available by default on the charge object.
Parameters
charge optional
Only return refunds for the charge specified by this charge ID.
payment_intent optional
Only return refunds for the PaymentIntent specified by this ID.
More parametersCollapse all
created optional dictionary
A filter on the list based on the object
created
field. The value can be a string with an integer Unix timestamp, or it can be a dictionary with the following options:Hide child parameters
created.gt optional
Return results where the
created
field is greater than this value.created.gte optional
Return results where the
created
field is greater than or equal to this value.created.lt optional
Return results where the
created
field is less than this value.created.lte optional
Return results where the
created
field is less than or equal to this value.
ending_before optional
A cursor for use in pagination.
ending_before
is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting withobj_bar
, your subsequent call can includeending_before=obj_bar
in order to fetch the previous page of the list.limit optional
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
starting_after optional
A cursor for use in pagination.
starting_after
is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending withobj_foo
, your subsequent call can includestarting_after=obj_foo
in order to fetch the next page of the list.
Returns
A dictionary with a data
property that contains an array of up to limit
refunds, starting after refund starting_after
. Each entry in the array is a separate refund object. If no more refunds are available, the resulting array will be empty. If you provide a non-existent charge ID, this call returns an error.List all refunds
Tokens
Tokenization is the process Payske uses to collect sensitive card or bank account details, or personally identifiable information (PII), directly from your customers in a secure manner. A token representing this information is returned to your server to use. You should use our recommended payments integrations to perform this process client-side. This ensures that no sensitive card data touches your server, and allows your integration to operate in a PCI-compliant way.
If you cannot use client-side tokenization, you can also create tokens using the API with either your publishable or secret API key. Keep in mind that if your integration uses this method, you are responsible for any PCI compliance that may be required, and you must keep your secret API key safe. Unlike with client-side tokenization, your customer's information is not sent directly to Payske, so we cannot determine how it is handled or stored.
Tokens cannot be stored or used more than once. To store card or bank account information for later use, you can create Customer objects or Custom accounts. Note that Radar, our integrated solution for automatic fraud protection, performs best with integrations that use client-side tokenization.
Related guide: Accept a payment
Was this section helpful?YesNo
The token object
The token object
{
"id": "tok_1Jwoyx2eZvKYlo2Cst4eQ7CX",
"object": "token",
"card": {
"id": "card_1Jwoyx2eZvKYlo2CzoY3eYaj",
"object": "card",
"address_city": null,
"address_country": null,
"address_line1": null,
"address_line1_check": null,
"address_line2": null,
"address_state": null,
"address_zip": null,
"address_zip_check": null,
"brand": "Visa",
"country": "US",
"cvc_check": "pass",
"dynamic_last4": null,
"exp_month": 8,
"exp_year": 2022,
"fingerprint": "Xt5EWLLDS7FJjR1c",
"funding": "credit",
"last4": "4242",
"metadata": {},
"name": null,
"tokenization_method": null
},
"client_ip": null,
"created": 1637158767,
"livemode": false,
"type": "card",
"used": false
}
Attributes
More attributesCollapse all
object string, value is "token"
String representing the object’s type. Objects of the same type share the same value.
bank_account hash
Hash describing the bank account.
Hide child attributes
bank_account.id string
Unique identifier for the object.
bank_account.object string, value is "bank_account"
String representing the object’s type. Objects of the same type share the same value.
bank_account.account_holder_name string
The name of the person or business that owns the bank account.
bank_account.account_holder_type string
The type of entity that holds the account. This can be either
individual
orcompany
.bank_account.account_type string
The bank account type. This can only be
checking
orsavings
in most countries. In Japan, this can only befutsu
ortoza
.bank_account.bank_name string
Name of the bank associated with the routing number (e.g.,
WELLS FARGO
).bank_account.country string
Two-letter ISO code representing the country the bank account is located in.
bank_account.currency currency
Three-letter ISO code for the currency paid out to the bank account.
bank_account.fingerprint string
Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same.
bank_account.last4 string
The last four digits of the bank account number.
bank_account.routing_number string
The routing transit number for the bank account.
bank_account.status string
For bank accounts, possible values are
new
,validated
,verified
,verification_failed
, orerrored
. A bank account that hasn’t had any activity or validation performed isnew
. If Payske can determine that the bank account exists, its status will bevalidated
. Note that there often isn’t enough information to know (e.g., for smaller credit unions), and the validation is not always run. If customer bank account verification has succeeded, the bank account status will beverified
. If the verification failed for any reason, such as microdeposit failure, the status will beverification_failed
. If a transfer sent to this bank account fails, we’ll set the status toerrored
and will not continue to send transfers until the bank details are updated.For external accounts, possible values are
new
anderrored
. Validations aren’t run against external accounts because they’re only used for payouts. This means the other statuses don’t apply. If a transfer fails, the status is set toerrored
and transfers are stopped until account details are updated.
card hash
Hash describing the card used to make the charge.
Hide child attributes
card.id string
Unique identifier for the object.
card.object string, value is "card"
String representing the object’s type. Objects of the same type share the same value.
card.address_city string
City/District/Suburb/Town/Village.
card.address_country string
Billing address country, if provided when creating card.
card.address_line1 string
Address line 1 (Street address/PO Box/Company name).
card.address_line1_check string
If
address_line1
was provided, results of the check:pass
,fail
,unavailable
, orunchecked
.card.address_line2 string
Address line 2 (Apartment/Suite/Unit/Building).
card.address_state string
State/County/Province/Region.
card.address_zip string
ZIP or postal code.
card.address_zip_check string
If
address_zip
was provided, results of the check:pass
,fail
,unavailable
, orunchecked
.card.brand string
Card brand. Can be
American Express
,Diners Club
,Discover
,JCB
,MasterCard
,UnionPay
,Visa
, orUnknown
.card.country string
Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you’ve collected.
card.currency currency
Three-letter ISO currency code, in lowercase. Must be a supported currency.
card.cvc_check string
If a CVC was provided, results of the check:
pass
,fail
,unavailable
, orunchecked
. A result of unchecked indicates that CVC was provided but hasn’t been checked yet. Checks are typically performed when attaching a card to a Customer object, or when creating a charge. For more details, see Check if a card is valid without a charge.card.dynamic_last4 string
(For tokenized numbers only.) The last four digits of the device account number.
card.exp_month integer
Two-digit number representing the card’s expiration month.
card.exp_year integer
Four-digit number representing the card’s expiration year.
card.fingerprint string
Uniquely identifies this particular card number. You can use this attribute to check whether two customers who’ve signed up with you are using the same card number, for example. For payment methods that tokenize card information (Apple Pay, Google Pay), the tokenized number might be provided instead of the underlying card number.
Starting May 1, 2021, card fingerprint in India for Connect will change to allow two fingerprints for the same card — one for India and one for the rest of the world.
card.funding string
Card funding type. Can be
credit
,debit
,prepaid
, orunknown
.card.last4 string
The last four digits of the card.
card.metadata hash
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
card.name string
Cardholder name.
card.tokenization_method string
If the card number is tokenized, this is the method that was used. Can be
android_pay
(includes Google Pay),apple_pay
,masterpass
,visa_checkout
, or null.
client_ip string
IP address of the client that generated the token.
created timestamp
Time at which the object was created. Measured in seconds since the Unix epoch.
livemode boolean
Has the value
true
if the object exists in live mode or the valuefalse
if the object exists in test mode.type string
Type of the token:
account
,bank_account
,card
, orpii
.used boolean
Whether this token has already been used (tokens can be used only once).
Create a card token
POST /v1/tokens
curl https://api.payske.com/v1/tokens \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d "card[number]"=4242424242424242 \
-d "card[exp_month]"=11 \
-d "card[exp_year]"=2022 \
-d "card[cvc]"=314
$payske = new \Payske\PayskeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$payske->tokens->create([
'card' => [
'number' => '4242424242424242',
'exp_month' => 11,
'exp_year' => 2022,
'cvc' => '314',
],
]);
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Token.create({
card: {
number: '4242424242424242',
exp_month: 11,
exp_year: 2022,
cvc: '314',
},
})
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Token.create(
card={
"number": "4242424242424242",
"exp_month": 11,
"exp_year": 2022,
"cvc": "314",
},
)
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Map<String, Object> card = new HashMap<>();
card.put("number", "4242424242424242");
card.put("exp_month", 11);
card.put("exp_year", 2022);
card.put("cvc", "314");
Map<String, Object> params = new HashMap<>();
params.put("card", card);
Token token = Token.create(params);
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const token = await payske.tokens.create({
card: {
number: '4242424242424242',
exp_month: 11,
exp_year: 2022,
cvc: '314',
},
});
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.TokenParams{
Card: &payske.CardParams{
Number: payske.String("4242424242424242"),
ExpMonth: payske.String("12"),
ExpYear: payske.String("2022"),
CVC: payske.String("123"),
},
}
t, err := token.New(params)
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new TokenCreateOptions
{
Card = new TokenCardOptions
{
Number = "4242424242424242",
ExpMonth = 11,
ExpYear = 2022,
Cvc = "314",
},
};
var service = new TokenService();
service.Create(options);
Response
{
"id": "tok_1Jwoyx2eZvKYlo2Cst4eQ7CX",
"object": "token",
"card": {
"id": "card_1Jwoyx2eZvKYlo2CzoY3eYaj",
"object": "card",
"address_city": null,
"address_country": null,
"address_line1": null,
"address_line1_check": null,
"address_line2": null,
"address_state": null,
"address_zip": null,
"address_zip_check": null,
"brand": "Visa",
"country": "US",
"cvc_check": "pass",
"dynamic_last4": null,
"exp_month": 8,
"exp_year": 2022,
"fingerprint": "Xt5EWLLDS7FJjR1c",
"funding": "credit",
"last4": "4242",
"metadata": {},
"name": null,
"tokenization_method": null
},
"client_ip": null,
"created": 1637158767,
"livemode": false,
"type": "card",
"used": false
}
Creates a single-use token that represents a credit card’s details. This token can be used in place of a credit card dictionary with any API method. These tokens can be used only once: by creating a new Charge object, or by attaching them to a Customer object.
In most cases, you should use our recommended payments integrations instead of using the API.
Parameters
card optional dictionary
The card this token will represent. If you also pass in a customer, the card must be the ID of a card belonging to the customer. Otherwise, if you do not pass in a customer, this is a dictionary containing a user's credit card details, with the options described below.
Hide child parameters
card.exp_month required
Two-digit number representing the card's expiration month.
card.exp_year required
Two- or four-digit number representing the card's expiration year.
card.number required
The card number, as a string without any separators.
card.currency optional
custom Connect only
Required in order to add the card to an account; in all other cases, this parameter is not used. When added to an account, the card (which must be a debit card) can be used as a transfer destination for funds in this currency.
card.cvc usually required
Card security code. Highly recommended to always include this value.
card.name optional
Cardholder's full name.
card.address_line1 optional
Address line 1 (Street address / PO Box / Company name).
card.address_line2 optional
Address line 2 (Apartment / Suite / Unit / Building).
card.address_city optional
City / District / Suburb / Town / Village.
card.address_state optional
State / County / Province / Region.
card.address_zip optional
ZIP or postal code.
card.address_country optional
Billing address country, if provided.
More parameters
customer optional
Connect only
The customer (owned by the application's account) for which to create a token. Also, this can be used only with an OAuth access token or Payske-Account header. For more details, see Cloning Saved Payment Methods.
Returns
Returns the created card token if successful. Otherwise, this call raises an error.
Create a bank account token
POST /v1/tokens
curl https://api.payske.com/v1/tokens \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d "bank_account[country]"=US \
-d "bank_account[currency]"=usd \
-d "bank_account[account_holder_name]"="Jenny Rosen" \
-d "bank_account[account_holder_type]"=individual \
-d "bank_account[routing_number]"=110000000 \
-d "bank_account[account_number]"=000123456789
$payske = new \Payske\PayskeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$payske->tokens->create([
'bank_account' => [
'country' => 'US',
'currency' => 'usd',
'account_holder_name' => 'Jenny Rosen',
'account_holder_type' => 'individual',
'routing_number' => '110000000',
'account_number' => '000123456789',
],
]);
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Token.create({
bank_account: {
country: 'US',
currency: 'usd',
account_holder_name: 'Jenny Rosen',
account_holder_type: 'individual',
routing_number: '110000000',
account_number: '000123456789',
},
})
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Token.create(
bank_account={
"country": "US",
"currency": "usd",
"account_holder_name": "Jenny Rosen",
"account_holder_type": "individual",
"routing_number": "110000000",
"account_number": "000123456789",
},
)
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Map<String, Object> bankAccount = new HashMap<>();
bankAccount.put("country", "US");
bankAccount.put("currency", "usd");
bankAccount.put(
"account_holder_name",
"Jenny Rosen"
);
bankAccount.put(
"account_holder_type",
"individual"
);
bankAccount.put("routing_number", "110000000");
bankAccount.put("account_number", "000123456789");
Map<String, Object> params = new HashMap<>();
params.put("bank_account", bankAccount);
Token token = Token.create(params);
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const token = await payske.tokens.create({
bank_account: {
country: 'US',
currency: 'usd',
account_holder_name: 'Jenny Rosen',
account_holder_type: 'individual',
routing_number: '110000000',
account_number: '000123456789',
},
});
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
t, err := token.New(&payske.TokenParams{
BankAccount: &payske.BankAccountParams{
Country: payske.String("US"),
Currency: payske.String(string(payske.CurrencyUSD)),
AccountHolderName: payske.String("Jenny Rosen"),
AccountHolderType: payske.String(string(payske.BankAccountAccountHolderTypeIndividual)),
RoutingNumber: payske.String("110000000"),
AccountNumber: payske.String("000123456789"),
},
})
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new TokenCreateOptions
{
BankAccount = new TokenBankAccountOptions
{
Country = "US",
Currency = "usd",
AccountHolderName = "Jenny Rosen",
AccountHolderType = "individual",
RoutingNumber = "110000000",
AccountNumber = "000123456789",
},
};
var service = new TokenService();
service.Create(options);
Response
{
"id": "btok_1Jwoyx2eZvKYlo2CeuW0logQ",
"object": "token",
"bank_account": {
"id": "ba_1Jwoyx2eZvKYlo2CylNVcYhE",
"object": "bank_account",
"account_holder_name": "Jane Austen",
"account_holder_type": "individual",
"account_type": null,
"bank_name": "PAYSKE TEST BANK",
"country": "US",
"currency": "usd",
"fingerprint": "1JWtPxqbdX5Gamtz",
"last4": "6789",
"routing_number": "110000000",
"status": "new"
},
"client_ip": null,
"created": 1637158767,
"livemode": false,
"type": "bank_account",
"used": false
}Response
{
"id": "btok_1Jwoyx2eZvKYlo2CeuW0logQ",
"object": "token",
"bank_account": {
"id": "ba_1Jwoyx2eZvKYlo2CylNVcYhE",
"object": "bank_account",
"account_holder_name": "Jane Austen",
"account_holder_type": "individual",
"account_type": null,
"bank_name": "PAYSKE TEST BANK",
"country": "US",
"currency": "usd",
"fingerprint": "1JWtPxqbdX5Gamtz",
"last4": "6789",
"routing_number": "110000000",
"status": "new"
},
"client_ip": null,
"created": 1637158767,
"livemode": false,
"type": "bank_account",
"used": false
}
Creates a single-use token that represents a bank account’s details. This token can be used with any API method in place of a bank account dictionary. This token can be used only once, by attaching it to a Custom account.
Parameters
bank_account optional
The bank account this token will represent.
Hide child parameters
bank_account.country required
The country in which the bank account is located.
bank_account.currency required
The currency the bank account is in. This must be a country/currency pairing that Payske supports.
bank_account.account_holder_name optional
The name of the person or business that owns the bank account. This field is required when attaching the bank account to a
Customer
object.bank_account.account_holder_type optional
The type of entity that holds the account. This can be either
individual
orcompany
. This field is required when attaching the bank account to aCustomer
object.bank_account.routing_number optional
The routing number, sort code, or other country-appropriate institution number for the bank account. For US bank accounts, this is required and should be the ACH routing number, not the wire routing number. If you are providing an IBAN for
account_number
, this field is not required.bank_account.account_number required
The account number for the bank account, in string form. Must be a checking account.
More parameters
customer optional
Connect only
The customer (owned by the application’s account) for which to create a token. This can be used only with an OAuth access token or Payske-Account header. For more details, see Cloning Saved Payment Methods.
Returns
Returns the created bank account token if successful. Otherwise, this call returns an error.
Retrieve a token
GET /v1/tokens/:id
curl https://api.payske.com/v1/tokens/tok_1Jwoyx2eZvKYlo2Cst4eQ7CX \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc:
$payske = new \Payske\PayskeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$payske->tokens->retrieve(
'tok_1Jx9xv2eZvKYlo2CiSvqBeAh',
[]
);
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Token.retrieve(
'tok_1JxAEN2eZvKYlo2CVVxeiATk',
)
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Token.retrieve(
"tok_1JxAYu2eZvKYlo2CxGJgJScw",
)
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Token token =
Token.retrieve("tok_1JxAnS2eZvKYlo2C3KpgVswv");
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const token = await payske.tokens.retrieve(
'tok_1JxAxp2eZvKYlo2CBXY5bfaO'
);
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
t, _ := token.Get(
"tok_1JxB9F2eZvKYlo2Ck8XdmmD3",
nil,
)
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var service = new TokenService();
service.Get("tok_1JxX3c2eZvKYlo2CnSyVWRfc");
Response
{
"id": "tok_1Jwoyx2eZvKYlo2Cst4eQ7CX",
"object": "token",
"card": {
"id": "card_1Jwoyx2eZvKYlo2CzoY3eYaj",
"object": "card",
"address_city": null,
"address_country": null,
"address_line1": null,
"address_line1_check": null,
"address_line2": null,
"address_state": null,
"address_zip": null,
"address_zip_check": null,
"brand": "Visa",
"country": "US",
"cvc_check": "pass",
"dynamic_last4": null,
"exp_month": 8,
"exp_year": 2022,
"fingerprint": "Xt5EWLLDS7FJjR1c",
"funding": "credit",
"last4": "4242",
"metadata": {},
"name": null,
"tokenization_method": null
},
"client_ip": null,
"created": 1637158767,
"livemode": false,
"type": "card",
"used": false
}
Retrieves the token with the given ID.
Parameters
No parameters.
Returns
Returns a token if a valid ID was provided. Returns an error otherwise.
Update Token
not allow update token after creation
List all tokens
Not applicable
_______________
PaymentMethods
PaymentMethod objects represent your customer's payment instruments. They can be used with PaymentIntents to collect payments or saved to Customer objects to store instrument details for future payments.
Related guides: Payment Methods and More Payment Scenarios.
Was this section helpful?YesNo
Sources
Source
objects allow you to accept a variety of payment methods. They represent a customer's payment instrument, and can be used with the Payske API just like a Card
object: once chargeable, they can be charged, or can be attached to customers.
Related guides: Sources API and Sources & Customers.
Was this section helpful? Yes No
The source object
The source object
{
"id": "src_1Jwvg92eZvKYlo2CeGmNMtVB",
"object": "source",
"ach_credit_transfer": {
"account_number": "test_52796e3294dc",
"routing_number": "110000000",
"fingerprint": "ecpwEzmBOSMOqQTL",
"bank_name": "TEST BANK",
"swift_code": "TSTEZ122"
},
"amount": null,
"client_secret": "src_client_secret_nT8WVTNQnmzFxfOTy3E4KNyo",
"created": 1637184509,
"currency": "usd",
"flow": "receiver",
"livemode": false,
"metadata": {},
"owner": {
"address": null,
"email": "jenny.rosen@example.com",
"name": null,
"phone": null,
"verified_address": null,
"verified_email": null,
"verified_name": null,
"verified_phone": null
},
"receiver": {
"address": "121042882-38381234567890123",
"amount_charged": 0,
"amount_received": 0,
"amount_returned": 0,
"refund_attributes_method": "email",
"refund_attributes_status": "missing"
},
"statement_descriptor": null,
"status": "pending",
"type": "ach_credit_transfer",
"usage": "reusable"
}
Attributes
id string
Unique identifier for the object.
amount integer
A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the total amount associated with the source. This is the amount for which the source will be chargeable once ready. Required for
single_use
sources.currency currency
Three-letter ISO code for the currency associated with the source. This is the currency for which the source will be chargeable once ready. Required for
single_use
sources.customer string
The ID of the customer to which this source is attached. This will not be present when the source has not been attached to a customer.
metadata hash
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
owner hash
Information about the owner of the payment instrument that may be used or required by particular source types.
Hide child attributes
owner.address hash
Owner’s address.
Hide child attributes
owner.address.city string
City, district, suburb, town, or village.
owner.address.country string
Two-letter country code (ISO 3166-1 alpha-2).
owner.address.line1 string
Address line 1 (e.g., street, PO Box, or company name).
owner.address.line2 string
Address line 2 (e.g., apartment, suite, unit, or building).
owner.address.postal_code string
ZIP or postal code.
owner.address.state string
State, county, province, or region.
owner.email string
Owner’s email address.
owner.name string
Owner’s full name.
owner.phone string
Owner’s phone number (including extension).
owner.verified_address hash
Verified owner’s address. Verified values are verified or provided by the payment method directly (and if supported) at the time of authorization or settlement. They cannot be set or mutated.
Hide child attributes
owner.verified_address.city string
City, district, suburb, town, or village.
owner.verified_address.country string
Two-letter country code (ISO 3166-1 alpha-2).
owner.verified_address.line1 string
Address line 1 (e.g., street, PO Box, or company name).
owner.verified_address.line2 string
Address line 2 (e.g., apartment, suite, unit, or building).
owner.verified_address.postal_code string
ZIP or postal code.
owner.verified_address.state string
State, county, province, or region.
owner.verified_email string
Verified owner’s email address. Verified values are verified or provided by the payment method directly (and if supported) at the time of authorization or settlement. They cannot be set or mutated.
owner.verified_name string
Verified owner’s full name. Verified values are verified or provided by the payment method directly (and if supported) at the time of authorization or settlement. They cannot be set or mutated.
owner.verified_phone string
Verified owner’s phone number (including extension). Verified values are verified or provided by the payment method directly (and if supported) at the time of authorization or settlement. They cannot be set or mutated.
redirect hash
Information related to the redirect flow. Present if the source is authenticated by a redirect (
flow
isredirect
).Hide child attributes
redirect.failure_reason string
The failure reason for the redirect, either
user_abort
(the customer aborted or dropped out of the redirect flow),declined
(the authentication failed or the transaction was declined), orprocessing_error
(the redirect failed due to a technical error). Present only if the redirect status isfailed
.redirect.return_url string
The URL you provide to redirect the customer to after they authenticated their payment.
redirect.status string
The status of the redirect, either
pending
(ready to be used by your customer to authenticate the transaction),succeeded
(succesful authentication, cannot be reused) ornot_required
(redirect should not be used) orfailed
(failed authentication, cannot be reused).redirect.url string
The URL provided to you to redirect a customer to as part of a
redirect
authentication flow.
statement_descriptor string
Extra information about a source. This will appear on your customer’s statement every time you charge the source.
status string
The status of the source, one of
canceled
,chargeable
,consumed
,failed
, orpending
. Onlychargeable
sources can be used to create a charge.type string
The
type
of the source. Thetype
is a payment method, one ofach_credit_transfer
,ach_debit
,alipay
,bancontact
,card
,card_present
,eps
,giropay
,ideal
,multibanco
,klarna
,p24
,sepa_debit
,sofort
,three_d_secure
, orwechat
. An additional hash is included on the source with a name matching this value. It contains additional information specific to the payment method used.
More attributesCollapse all
object string, value is "source"
String representing the object’s type. Objects of the same type share the same value.
client_secret string
The client secret of the source. Used for client-side retrieval using a publishable key.
code_verification hash
Information related to the code verification flow. Present if the source is authenticated by a verification code (
flow
iscode_verification
).Hide child attributes
code_verification.attempts_remaining integer
The number of attempts remaining to authenticate the source object with a verification code.
code_verification.status string
The status of the code verification, either
pending
(awaiting verification,attempts_remaining
should be greater than 0),succeeded
(successful verification) orfailed
(failed verification, cannot be verified anymore asattempts_remaining
should be 0).
created timestamp
Time at which the object was created. Measured in seconds since the Unix epoch.
flow string
The authentication
flow
of the source.flow
is one ofredirect
,receiver
,code_verification
,none
.livemode boolean
Has the value
true
if the object exists in live mode or the valuefalse
if the object exists in test mode.receiver hash
Information related to the receiver flow. Present if the source is a receiver (
flow
isreceiver
).Hide child attributes
receiver.address string
The address of the receiver source. This is the value that should be communicated to the customer to send their funds to.
receiver.amount_charged integer
The total amount that was moved to your balance. This is almost always equal to the amount charged. In rare cases when customers deposit excess funds and we are unable to refund those, those funds get moved to your balance and show up in amount_charged as well. The amount charged is expressed in the source’s currency.
receiver.amount_received integer
The total amount received by the receiver source.
amount_received = amount_returned + amount_charged
should be true for consumed sources unless customers deposit excess funds. The amount received is expressed in the source’s currency.receiver.amount_returned integer
The total amount that was returned to the customer. The amount returned is expressed in the source’s currency.
receiver.refund_attributes_method string
Type of refund attribute method, one of
email
,manual
, ornone
.receiver.refund_attributes_status string
Type of refund attribute status, one of
missing
,requested
, oravailable
.
source_order hash
Information about the items and shipping associated with the source. Required for transactional credit (for example Klarna) sources before you can charge it.
Hide child attributes
source_order.amount integer
A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the total amount for the order.
source_order.currency currency
Three-letter ISO currency code, in lowercase. Must be a supported currency.
source_order.email string
The email address of the customer placing the order.
source_order.items array of hashes
List of items constituting the order.
Show child attributes
source_order.shipping hash
The shipping address for the order. Present if the order is for goods to be shipped.
Hide child attributes
source_order.shipping.address hash
Shipping address.
Show child attributes
source_order.shipping.carrier string
The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc.
source_order.shipping.name string
Recipient name.
source_order.shipping.phone string
Recipient phone (including extension).
source_order.shipping.tracking_number string
The tracking number for a physical product, obtained from the delivery service. If multiple tracking numbers were generated for this purchase, please separate them with commas.
usage string
Either
reusable
orsingle_use
. Whether this source should be reusable or not. Some source types may or may not be reusable by construction, while others may leave the option at creation. If an incompatible value is passed, an error will be returned.
Create a source
POST /v1/sources
curl https://api.payske.com/v1/sources \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d type=ach_credit_transfer \
-d currency=usd \
-d "owner[email]"="jenny.rosen@example.com"
$payske = new \Payske\PayskeClient("sk_test_4eC39HqLyjWDarjtT1zdp7dc");
$payske->sources->create([
"type" => "ach_credit_transfer",
"currency" => "usd",
"owner" => [
"email" => "jenny.rosen@example.com"
]
]);
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Source.create({
type: 'ach_credit_transfer',
currency: 'usd',
owner: {
email: 'jenny.rosen@example.com',
},
})
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Source.create(
type='ach_credit_transfer',
currency='usd',
owner={
'email': 'jenny.rosen@example.com'
}
)
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Map<String, Object> sourceParams = new HashMap<>();
sourceParams.put("type", "ach_credit_transfer");
sourceParams.put("currency", "usd");
Map<String, Object> ownerParams = new HashMap<>();
ownerParams.put("email", "jenny.rosen@example.com");
sourceParams.put("owner", ownerParams);
Source.create(sourceParams);
const Payske = require('payske');
const payske = Payske('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
payske.sources.create({
type: 'ach_credit_transfer',
currency: 'usd',
owner: {
email: 'jenny.rosen@example.com'
}
}, function(err, source) {
// asynchronously called
});
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.SourceObjectParams{
Type: payske.String("ach_credit_transfer"),
Currency: payske.String(string(payske.CurrencyUSD)),
Owner: &payske.SourceOwnerParams{
Email: payske.String("jenny.rosen@example.com"),
},
}
s, err := source.New(params)
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new SourceCreateOptions {
Type = SourceType.AchCreditTransfer,
Currency = "usd",
Owner = new SourceOwnerOptions {
Email = "jenny.rosen@example.com"
}
};
var service = new SourceService();
Source source = service.Create(options);
Response
{
"id": "src_1Jwvg92eZvKYlo2CeGmNMtVB",
"object": "source",
"ach_credit_transfer": {
"account_number": "test_52796e3294dc",
"routing_number": "110000000",
"fingerprint": "ecpwEzmBOSMOqQTL",
"bank_name": "TEST BANK",
"swift_code": "TSTEZ122"
},
"amount": null,
"client_secret": "src_client_secret_nT8WVTNQnmzFxfOTy3E4KNyo",
"created": 1637184509,
"currency": "usd",
"flow": "receiver",
"livemode": false,
"metadata": {},
"owner": {
"address": null,
"email": "jenny.rosen@example.com",
"name": null,
"phone": null,
"verified_address": null,
"verified_email": null,
"verified_name": null,
"verified_phone": null
},
"receiver": {
"address": "121042882-38381234567890123",
"amount_charged": 0,
"amount_received": 0,
"amount_returned": 0,
"refund_attributes_method": "email",
"refund_attributes_status": "missing"
},
"statement_descriptor": null,
"status": "pending",
"type": "ach_credit_transfer",
"usage": "reusable"
}
Creates a new source object.
Parameters
type required
The
type
of the source to create. Required unlesscustomer
andoriginal_source
are specified (see the Cloning card Sources guide)amount optional
Amount associated with the source. This is the amount for which the source will be chargeable once ready. Required for
single_use
sources. Not supported forreceiver
type sources, where charge amount may not be specified until funds land.currency optional
Three-letter ISO code for the currency associated with the source. This is the currency for which the source will be chargeable once ready.
metadata optional associative array
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to
metadata
.owner optional associative array
Information about the owner of the payment instrument that may be used or required by particular source types.
Hide child parameters
owner.address optional associative array
Owner’s address.
Hide child parameters
owner.address.city optional
City, district, suburb, town, or village.
owner.address.country optional
Two-letter country code (ISO 3166-1 alpha-2).
owner.address.line1 optional
Address line 1 (e.g., street, PO Box, or company name).
owner.address.line2 optional
Address line 2 (e.g., apartment, suite, unit, or building).
owner.address.postal_code optional
ZIP or postal code.
owner.address.state optional
State, county, province, or region.
owner.email optional
Owner’s email address.
owner.name optional
Owner’s full name.
owner.phone optional
Owner’s phone number.
redirect optional associative array
Parameters required for the redirect flow. Required if the source is authenticated by a redirect (
flow
isredirect
).Hide child parameters
statement_descriptor optional
An arbitrary string to be displayed on your customer’s statement. As an example, if your website is
RunClub
and the item you’re charging for is a race ticket, you may want to specify astatement_descriptor
ofRunClub 5K race ticket.
While many payment types will display this information, some may not display it at all.
More parametersCollapse all
flow optional
The authentication
flow
of the source to create.flow
is one ofredirect
,receiver
,code_verification
,none
. It is generally inferred unless a type supports multiple flows.mandate optional associative array
Information about a mandate possibility attached to a source object (generally for bank debits) as well as its acceptance status.
Hide child parameters
mandate.acceptance optional associative array
The parameters required to notify Payske of a mandate acceptance or refusal by the customer.
Show child parameters
mandate.amount optional
The amount specified by the mandate. (Leave null for a mandate covering all amounts)
mandate.currency optional
The currency specified by the mandate. (Must match
currency
of the source)mandate.interval optional
The interval of debits permitted by the mandate. Either
one_time
(just permitting a single debit),scheduled
(with debits on an agreed schedule or for clearly-defined events), orvariable
(for debits with any frequency)mandate.notification_method optional
The method Payske should use to notify the customer of upcoming debit instructions and/or mandate confirmation as required by the underlying debit network. Either
email
(an email is sent directly to the customer),manual
(asource.mandate_notification
event is sent to your webhooks endpoint and you should handle the notification) ornone
(the underlying debit network does not require any notification).
receiver optional associative array
Optional parameters for the receiver flow. Can be set only if the source is a receiver (
flow
isreceiver
).Hide child parameters
receiver.refund_attributes_method optional
The method Payske should use to request information needed to process a refund or mispayment. Either
email
(an email is sent directly to the customer) ormanual
(asource.refund_attributes_required
event is sent to your webhooks endpoint). Refer to each payment method’s documentation to learn which refund attributes may be required.
source_order optional associative array
Information about the items and shipping associated with the source. Required for transactional credit (for example Klarna) sources before you can charge it.
Hide child parameters
source_order.items optional array of hashes
List of items constituting the order.
Show child parameters
source_order.shipping optional associative array
Shipping address for the order. Required if any of the SKUs are for products that have
shippable
set to true.Hide child parameters
source_order.shipping.address required
Shipping address.
Hide child parameters
source_order.shipping.address.line1 required
Address line 1 (e.g., street, PO Box, or company name).
source_order.shipping.address.city optional
City, district, suburb, town, or village.
source_order.shipping.address.country optional
Two-letter country code (ISO 3166-1 alpha-2).
source_order.shipping.address.line2 optional
Address line 2 (e.g., apartment, suite, unit, or building).
source_order.shipping.address.postal_code optional
ZIP or postal code.
source_order.shipping.address.state optional
State, county, province, or region.
source_order.shipping.carrier optional
The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc.
source_order.shipping.name optional
Recipient name.
source_order.shipping.phone optional
Recipient phone (including extension).
source_order.shipping.tracking_number optional
The tracking number for a physical product, obtained from the delivery service. If multiple tracking numbers were generated for this purchase, please separate them with commas.
token optional
An optional token used to create the source. When passed, token properties will override source parameters.
usage optional
Either
reusable
orsingle_use
. Whether this source should be reusable or not. Some source types may or may not be reusable by construction, while others may leave the option at creation. If an incompatible value is passed, an error will be returned.
Returns
Returns a newly created source.
Retrieve a source
GET /v1/sources/:id
curl https://api.payske.com/v1/sources/src_1JwwRo2eZvKYlo2CZnVjJKlC \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc:
$payske = new \Payske\PayskeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$payske->sources->retrieve(
'src_1Jx9xt2eZvKYlo2CRdyvKklA',
[]
);
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Source.retrieve(
'src_1JxAEO2eZvKYlo2CxpWstPxA',
)
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Source.retrieve(
"src_1JxAYu2eZvKYlo2C4YvOJ3Ad",
)
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Source source =
Source.retrieve("src_1JxAnS2eZvKYlo2CuLrl9mm1");
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const source = await payske.sources.retrieve(
'src_1JxAxp2eZvKYlo2CDti7eaHx'
);
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
s, _ := source.Get(
"src_1JxB9F2eZvKYlo2CkP36Z4dl",
nil,
)
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var service = new SourceService();
service.Get("src_1JxX3c2eZvKYlo2CXU7KrTqR");
Response
{
"id": "src_1Jwvg92eZvKYlo2CeGmNMtVB",
"object": "source",
"ach_credit_transfer": {
"account_number": "test_52796e3294dc",
"routing_number": "110000000",
"fingerprint": "ecpwEzmBOSMOqQTL",
"bank_name": "TEST BANK",
"swift_code": "TSTEZ122"
},
"amount": null,
"client_secret": "src_client_secret_nT8WVTNQnmzFxfOTy3E4KNyo",
"created": 1637184509,
"currency": "usd",
"flow": "receiver",
"livemode": false,
"metadata": {},
"owner": {
"address": null,
"email": "jenny.rosen@example.com",
"name": null,
"phone": null,
"verified_address": null,
"verified_email": null,
"verified_name": null,
"verified_phone": null
},
"receiver": {
"address": "121042882-38381234567890123",
"amount_charged": 0,
"amount_received": 0,
"amount_returned": 0,
"refund_attributes_method": "email",
"refund_attributes_status": "missing"
},
"statement_descriptor": null,
"status": "pending",
"type": "ach_credit_transfer",
"usage": "reusable"
}
Retrieves an existing source object. Supply the unique source ID from a source creation request and Payske will return the corresponding up-to-date source object information.
ParametersCollapse all
client_secret optional
The client secret of the source. Required if a publishable key is used to retrieve the source.
Returns
Returns a source if a valid identifier was provided.
Update a source
POST /v1/sources/:id
curl https://api.payske.com/v1/sources/src_1JwwRo2eZvKYlo2CZnVjJKlC \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d "metadata[order_id]"=6735
$payske = new \Payske\PayskeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$payske->sources->update(
'src_1Jx9xt2eZvKYlo2CRdyvKklA',
['metadata' => ['order_id' => '6735']]
);
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Source.update(
'src_1JxAEO2eZvKYlo2CxpWstPxA',
{metadata: {order_id: '6735'}},
)
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Source.modify(
"src_1JxAYu2eZvKYlo2C4YvOJ3Ad",
metadata={"order_id": "6735"},
)
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Source source =
Source.retrieve("src_1JxAnS2eZvKYlo2CuLrl9mm1");
Map<String, Object> metadata = new HashMap<>();
metadata.put("order_id", "6735");
Map<String, Object> params = new HashMap<>();
params.put("metadata", metadata);
Source updatedSource = source.update(params);
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const source = await payske.sources.update(
'src_1JxAxp2eZvKYlo2CDti7eaHx',
{metadata: {order_id: '6735'}}
);
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.SourceObjectParams{}
params.AddMetadata("order_id", "6735")
s, _ := source.Update(
"src_1JxB9F2eZvKYlo2CkP36Z4dl",
params,
)
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new SourceUpdateOptions
{
Metadata = new Dictionary<string, string>
{
{ "order_id", "6735" },
},
};
var service = new SourceService();
service.Update(
"src_1JxX3c2eZvKYlo2CXU7KrTqR",
options
);
Response
{
"id": "src_1JwwRo2eZvKYlo2CZnVjJKlC",
"object": "source",
"ach_credit_transfer": {
"account_number": "test_52796e3294dc",
"routing_number": "110000000",
"fingerprint": "ecpwEzmBOSMOqQTL",
"bank_name": "TEST BANK",
"swift_code": "TSTEZ122"
},
"amount": null,
"client_secret": "src_client_secret_pv0r2LJ9ceAUZWHFP7sMFUGa",
"created": 1637187464,
"currency": "usd",
"flow": "receiver",
"livemode": false,
"metadata": {
"order_id": "6735"
},
"owner": {
"address": null,
"email": "jenny.rosen@example.com",
"name": null,
"phone": null,
"verified_address": null,
"verified_email": null,
"verified_name": null,
"verified_phone": null
},
"receiver": {
"address": "121042882-38381234567890123",
"amount_charged": 0,
"amount_received": 0,
"amount_returned": 0,
"refund_attributes_method": "email",
"refund_attributes_status": "missing"
},
"statement_descriptor": null,
"status": "pending",
"type": "ach_credit_transfer",
"usage": "reusable"
}
Updates the specified source by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
This request accepts the metadata
and owner
as arguments. It is also possible to update type specific information for selected payment methods. Please refer to our payment method guides for more detail.
Parameters
amount optional
Amount associated with the source.
metadata optional associative array
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to
metadata
.owner optional associative array
Information about the owner of the payment instrument that may be used or required by particular source types.
Hide child parameters
owner.address optional associative array
Owner’s address.
Hide child parameters
owner.address.city optional
City, district, suburb, town, or village.
owner.address.country optional
Two-letter country code (ISO 3166-1 alpha-2).
owner.address.line1 optional
Address line 1 (e.g., street, PO Box, or company name).
owner.address.line2 optional
Address line 2 (e.g., apartment, suite, unit, or building).
owner.address.postal_code optional
ZIP or postal code.
owner.address.state optional
State, county, province, or region.
owner.email optional
Owner’s email address.
owner.name optional
Owner’s full name.
owner.phone optional
Owner’s phone number.
More parametersCollapse all
mandate optional associative array
Information about a mandate possibility attached to a source object (generally for bank debits) as well as its acceptance status.
Hide child parameters
mandate.acceptance optional associative array
The parameters required to notify Payske of a mandate acceptance or refusal by the customer.
Hide child parameters
mandate.acceptance.date required
The Unix timestamp (in seconds) when the mandate was accepted or refused by the customer.
mandate.acceptance.status required
The status of the mandate acceptance. Either
accepted
(the mandate was accepted) orrefused
(the mandate was refused).mandate.acceptance.ip optional
The IP address from which the mandate was accepted or refused by the customer.
mandate.acceptance.offline optional associative array
The parameters required to store a mandate accepted offline. Should only be set if
mandate[type]
isoffline
Show child parameters
mandate.acceptance.online optional associative array
The parameters required to store a mandate accepted online. Should only be set if
mandate[type]
isonline
Show child parameters
mandate.acceptance.type optional
The type of acceptance information included with the mandate. Either
online
oroffline
mandate.acceptance.user_agent optional
The user agent of the browser from which the mandate was accepted or refused by the customer.
mandate.amount optional
The amount specified by the mandate. (Leave null for a mandate covering all amounts)
mandate.currency optional
The currency specified by the mandate. (Must match
currency
of the source)mandate.interval optional
The interval of debits permitted by the mandate. Either
one_time
(just permitting a single debit),scheduled
(with debits on an agreed schedule or for clearly-defined events), orvariable
(for debits with any frequency)mandate.notification_method optional
The method Payske should use to notify the customer of upcoming debit instructions and/or mandate confirmation as required by the underlying debit network. Either
email
(an email is sent directly to the customer),manual
(asource.mandate_notification
event is sent to your webhooks endpoint and you should handle the notification) ornone
(the underlying debit network does not require any notification).
source_order optional associative array
Information about the items and shipping associated with the source. Required for transactional credit (for example Klarna) sources before you can charge it.
Hide child parameters
source_order.items optional array of hashes
List of items constituting the order.
Hide child parameters
source_order.items.amount optional
source_order.items.currency optional
source_order.items.description optional
source_order.items.parent optional
The ID of the SKU being ordered.
source_order.items.quantity optional
The quantity of this order item. When type is
sku
, this is the number of instances of the SKU to be ordered.source_order.items.type optional
source_order.shipping optional associative array
Shipping address for the order. Required if any of the SKUs are for products that have
shippable
set to true.Hide child parameters
source_order.shipping.address required
Shipping address.
Hide child parameters
source_order.shipping.address.line1 required
Address line 1 (e.g., street, PO Box, or company name).
source_order.shipping.address.city optional
City, district, suburb, town, or village.
source_order.shipping.address.country optional
Two-letter country code (ISO 3166-1 alpha-2).
source_order.shipping.address.line2 optional
Address line 2 (e.g., apartment, suite, unit, or building).
source_order.shipping.address.postal_code optional
ZIP or postal code.
source_order.shipping.address.state optional
State, county, province, or region.
source_order.shipping.carrier optional
The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc.
source_order.shipping.name optional
Recipient name.
source_order.shipping.phone optional
Recipient phone (including extension).
source_order.shipping.tracking_number optional
The tracking number for a physical product, obtained from the delivery service. If multiple tracking numbers were generated for this purchase, please separate them with commas.
Returns
Returns the source object if the update succeeded. This call will throw an error if update parameters are invalid.
Attach a source
POST /v1/customers/:id/sources
curl https://api.payske.com/v1/customers/cus_AJ6yA7mRH34mJT/sources \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d source=src_1JwwRo2eZvKYlo2CZnVjJKlC
$payske = new \Payske\PayskeClient("sk_test_4eC39HqLyjWDarjtT1zdp7dc");
$payske->customers->createSource(
'cus_AJ6yA7mRH34mJT',
[
'source' => 'src_1Jx9xt2eZvKYlo2CRdyvKklA',
]
);
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Customer.create_source(
'cus_AJ6yA7mRH34mJT',
{
source: 'src_1JxAEO2eZvKYlo2CxpWstPxA',
}
)
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
source = payske.Customer.create_source(
'cus_AJ6yA7mRH34mJT',
source='src_1JxAYu2eZvKYlo2C4YvOJ3Ad'
)
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
List<String> expandList = new ArrayList<>();
expandList.add("sources");
Map<String, Object> retrieveParams = new HashMap<>();
retrieveParams.put("expand", expandList);
Customer customer =
Customer.retrieve(
"cus_AJ6yA7mRH34mJT",
retrieveParams,
null
);
Map<String, Object> params = new HashMap<>();
params.put("source", "src_1JxAnS2eZvKYlo2CuLrl9mm1");
customer.getSources().create(params);
const Payske = require('payske');
const payske = Payske('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
payske.customers.createSource(
'cus_AJ6yA7mRH34mJT',
{
source: 'src_1JxAxp2eZvKYlo2CDti7eaHx',
},
function(err, source) {
// asynchronously called
}
);
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.CustomerSourceParams{
Customer: payske.String("cus_AJ6yA7mRH34mJT"),
Source: &payske.SourceParams{
Token: payske.String("src_1JxB9F2eZvKYlo2CkP36Z4dl"),
},
}
s, err := paymentsource.New(params)
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new SourceAttachOptions
{
Source = "src_1JxX3c2eZvKYlo2CXU7KrTqR",
};
var service = new SourceService();
var source = service.Attach('cus_AJ6yA7mRH34mJT', options);
Response
{
"id": "src_1JwwRo2eZvKYlo2CZnVjJKlC",
"object": "source",
"ach_credit_transfer": {
"account_number": "test_52796e3294dc",
"routing_number": "110000000",
"fingerprint": "ecpwEzmBOSMOqQTL",
"bank_name": "TEST BANK",
"swift_code": "TSTEZ122"
},
"amount": 1000,
"client_secret": "src_client_secret_pv0r2LJ9ceAUZWHFP7sMFUGa",
"created": 1637187464,
"currency": "usd",
"flow": "receiver",
"livemode": false,
"metadata": {},
"owner": {
"address": null,
"email": "jenny.rosen@example.com",
"name": null,
"phone": null,
"verified_address": null,
"verified_email": null,
"verified_name": null,
"verified_phone": null
},
"receiver": {
"address": "121042882-38381234567890123",
"amount_received": 1000,
"amount_charged": 0,
"amount_returned": 0,
"refund_attributes_status": "missing",
"refund_attributes_method": "email"
},
"statement_descriptor": null,
"status": "chargeable",
"type": "ach_credit_transfer",
"usage": "reusable",
"customer": "cus_AJ6yA7mRH34mJT"
}
Attaches a Source object to a Customer. The source must be in a chargeable or pending state.
Parameters
Returns
Returns the attached Source object.
Detach a source
DELETE /v1/customers/:id/sources/:id
curl https://api.payske.com/v1/customers/cus_AJ6yA7mRH34mJT/sources/src_1JwwRo2eZvKYlo2CZnVjJKlC \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-X DELETE
$payske = new \Payske\PayskeClient("sk_test_4eC39HqLyjWDarjtT1zdp7dc");
$payske->customers->deleteSource(
'cus_AJ6yA7mRH34mJT',
'src_1JxXtD2eZvKYlo2CZ8wOZpcJ'
);
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Customer.detach_source(
'cus_AJ6yA7mRH34mJT',
'src_1JxAEO2eZvKYlo2CxpWstPxA'
)
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Customer.delete_source(
'cus_AJ6yA7mRH34mJT',
'src_1JxAYu2eZvKYlo2C4YvOJ3Ad'
)
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Source source = Source.retrieve("src_1JxAnS2eZvKYlo2CuLrl9mm1");
source.detach();
const Payske = require('payske');
const payske = Payske('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
payske.customers.deleteSource(
'cus_AJ6yA7mRH34mJT',
'src_1JxAxp2eZvKYlo2CDti7eaHx',
function(err, confirmation) {
// asynchronously called
}
);
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.SourceObjectDetachParams{
Customer: payske.String("cus_AJ6yA7mRH34mJT"),
}
s, err := source.Detach("src_1JxB9F2eZvKYlo2CkP36Z4dl", params)payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.SourceObjectDetachParams{
Customer: payske.String("cus_AJ6yA7mRH34mJT"),
}
s, err := source.Detach("src_1JxB9F2eZvKYlo2CkP36Z4dl", params)
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var service = new SourceService();
var source = service.Detach("cus_AJ6yA7mRH34mJT", "src_1JxX3c2eZvKYlo2CXU7KrTqR");
Response
{
"id": "src_1JwwRo2eZvKYlo2CZnVjJKlC",
"object": "source",
"ach_credit_transfer": {
"account_number": "test_52796e3294dc",
"routing_number": "110000000",
"fingerprint": "ecpwEzmBOSMOqQTL",
"bank_name": "TEST BANK",
"swift_code": "TSTEZ122"
},
"amount": 0,
"client_secret": "src_client_secret_pv0r2LJ9ceAUZWHFP7sMFUGa",
"created": 1637187464,
"currency": "usd",
"flow": "receiver",
"livemode": false,
"metadata": {},
"owner": {
"address": null,
"email": "jenny.rosen@example.com",
"name": null,
"phone": null,
"verified_address": null,
"verified_email": null,
"verified_name": null,
"verified_phone": null
},
"receiver": {
"address": "121042882-38381234567890123",
"amount_received": 1000,
"amount_charged": 1000,
"amount_returned": 0,
"refund_attributes_status": "missing",
"refund_attributes_method": "email"
},
"statement_descriptor": null,
"status": "consumed",
"type": "ach_credit_transfer",
"usage": "reusable",
"customer": "cus_AJ6yA7mRH34mJT"
}
Detaches a Source object from a Customer. The status of a source is changed to consumed
when it is detached and it can no longer be used to create a charge.
Parameters
No parameters.
Returns
Returns the detached Source object.
Cards
You can store multiple cards on a customer in order to charge the customer later. You can also store multiple debit cards on a recipient in order to transfer to those cards later.
Related guide: Card Payments with Sources.
Was this section helpful? Yes No
The card object
The card object
{
"id": "card_1Jwvx22eZvKYlo2C7q732luw",
"object": "card",
"address_city": null,
"address_country": null,
"address_line1": null,
"address_line1_check": null,
"address_line2": null,
"address_state": null,
"address_zip": null,
"address_zip_check": null,
"brand": "Visa",
"country": "US",
"customer": null,
"cvc_check": "pass",
"dynamic_last4": null,
"exp_month": 8,
"exp_year": 2022,
"fingerprint": "Xt5EWLLDS7FJjR1c",
"funding": "credit",
"last4": "4242",
"metadata": {},
"name": null,
"tokenization_method": null
}
Attributes
id string
Unique identifier for the object.
address_city string
City/District/Suburb/Town/Village.
address_country string
Billing address country, if provided when creating card.
address_line1 string
Address line 1 (Street address/PO Box/Company name).
address_line2 string
Address line 2 (Apartment/Suite/Unit/Building).
address_state string
State/County/Province/Region.
address_zip string
ZIP or postal code.
address_zip_check string
If
address_zip
was provided, results of the check:pass
,fail
,unavailable
, orunchecked
.brand string
Card brand. Can be
American Express
,Diners Club
,Discover
,JCB
,MasterCard
,UnionPay
,Visa
, orUnknown
.country string
Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you’ve collected.
customer string
The customer that this card belongs to. This attribute will not be in the card object if the card belongs to an account or recipient instead.
cvc_check string
If a CVC was provided, results of the check:
pass
,fail
,unavailable
, orunchecked
. A result of unchecked indicates that CVC was provided but hasn’t been checked yet. Checks are typically performed when attaching a card to a Customer object, or when creating a charge. For more details, see Check if a card is valid without a charge.exp_month integer
Two-digit number representing the card’s expiration month.
exp_year integer
Four-digit number representing the card’s expiration year.
fingerprint string
Uniquely identifies this particular card number. You can use this attribute to check whether two customers who’ve signed up with you are using the same card number, for example. For payment methods that tokenize card information (Apple Pay, Google Pay), the tokenized number might be provided instead of the underlying card number.
Starting May 1, 2021, card fingerprint in India for Connect will change to allow two fingerprints for the same card — one for India and one for the rest of the world.
funding string
Card funding type. Can be
credit
,debit
,prepaid
, orunknown
.last4 string
The last four digits of the card.
metadata hash
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
name string
Cardholder name.
More attributesCollapse all
object string, value is "card"
String representing the object’s type. Objects of the same type share the same value.
account string
custom Connect only
The account this card belongs to. This attribute will not be in the card object if the card belongs to a customer or recipient instead.
address_line1_check string
If
address_line1
was provided, results of the check:pass
,fail
,unavailable
, orunchecked
.available_payout_methods array
A set of available payout methods for this card. Only values from this set should be passed as the
method
when creating a payout.currency currency
custom Connect only
Three-letter ISO code for currency. Only applicable on accounts (not customers or recipients). The card can be used as a transfer destination for funds in this currency.
dynamic_last4 string
(For tokenized numbers only.) The last four digits of the device account number.
recipient string
The recipient that this card belongs to. This attribute will not be in the card object if the card belongs to a customer or account instead.
tokenization_method string
If the card number is tokenized, this is the method that was used. Can be
android_pay
(includes Google Pay),apple_pay
,masterpass
,visa_checkout
, or null.
Create a card
POST /v1/customers/:id/sources
curl https://api.payske.com/v1/customers/cus_AJ6yA7mRH34mJT/sources \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d source=tok_amex
$payske = new \Payske\PayskeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$payske->customers->createSource(
'cus_AJ6yA7mRH34mJT',
['source' => 'tok_amex']
);
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Customer.create_source(
'cus_AJ6yA7mRH34mJT',
{source: 'tok_mastercard'},
)
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Customer.create_source(
"cus_AJ6yA7mRH34mJT",
source="tok_visa",
)
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Map<String, Object> retrieveParams =
new HashMap<>();
List<String> expandList = new ArrayList<>();
expandList.add("sources");
retrieveParams.put("expand", expandList);
Customer customer =
Customer.retrieve(
"cus_AJ6yA7mRH34mJT",
retrieveParams,
null
);
Map<String, Object> params = new HashMap<>();
params.put("source", "tok_amex");
Card card =
(Card) customer.getSources().create(params);
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const card = await payske.customers.createSource(
'cus_AJ6yA7mRH34mJT',
{source: 'tok_mastercard'}
);
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.CardParams{
Customer: payske.String("cus_AJ6yA7mRH34mJT"),
Token: payske.String("tok_amex"),
}
c, err := card.New(params)
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new CardCreateOptions
{
Source = "tok_visa",
};
var service = new CardService();
service.Create("cus_AJ6yA7mRH34mJT", options);
Response
{
"id": "card_1Jwvx22eZvKYlo2C7q732luw",
"object": "card",
"address_city": null,
"address_country": null,
"address_line1": null,
"address_line1_check": null,
"address_line2": null,
"address_state": null,
"address_zip": null,
"address_zip_check": null,
"brand": "Visa",
"country": "US",
"customer": "cus_AJ6yA7mRH34mJT",
"cvc_check": "pass",
"dynamic_last4": null,
"exp_month": 8,
"exp_year": 2022,
"fingerprint": "Xt5EWLLDS7FJjR1c",
"funding": "credit",
"last4": "4242",
"metadata": {},
"name": null,
"tokenization_method": null
}
When you create a new credit card, you must specify a customer or recipient on which to create it.
If the card’s owner has no default card, then the new card will become the default. However, if the owner already has a default, then it will not change. To change the default, you should update the customer to have a new default_source
.
Parameters
source required
A token, like the ones returned by Payske.js. Payske will automatically validate the card.
Hide child parameters
source.object required
The type of payment source. Should be
card
.source.number required
The card number, as a string without any separators.
source.exp_month required
Two-digit number representing the card's expiration month.
source.exp_year required
Two- or four-digit number representing the card's expiration year.
source.cvc optional
Card security code. Highly recommended to always include this value, but it's required only for accounts based in European countries.
source.currency optional
custom Connect only
Required when adding a card to an account (not applicable to customers or recipients). The card (which must be a debit card) can be used as a transfer destination for funds in this currency.
source.name optional
Cardholder's full name.
source.metadata optional dictionary
A set of key-value pairs that you can attach to a card object. This can be useful for storing additional information about the card in a structured format.
source.default_for_currency optional
custom Connect only
Applicable only on accounts (not customers or recipients). If you set this to
true
(or if this is the first external account being added in this currency), this card will become the default external account for its currency.source.address_line1 optional
Address line 1 (Street address / PO Box / Company name).
source.address_line2 optional
Address line 2 (Apartment / Suite / Unit / Building).
source.address_city optional
City / District / Suburb / Town / Village.
source.address_state optional
State / County / Province / Region.
source.address_zip optional
ZIP or postal code.
source.address_country optional
Billing address country, if provided.
metadata optional dictionary
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to
metadata
.
Returns
Returns the Card
object.
Retrieve a card
GET /v1/customers/:id/sources/:id
curl https://api.payske.com/v1/customers/cus_AJ6yA7mRH34mJT/sources/card_1Jwvx22eZvKYlo2C7q732luw \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc:
$payske = new \Payske\PayskeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$payske->customers->retrieveSource(
'cus_AJ6yA7mRH34mJT',
'card_1Jx9xt2eZvKYlo2CmDZcDDHY',
[]
);
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Customer.retrieve_source(
'cus_AJ6yA7mRH34mJT',
'card_1JxAEM2eZvKYlo2CaqgYB2xk',
)
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Customer.retrieve_source(
"cus_AJ6yA7mRH34mJT",
"card_1JxAYt2eZvKYlo2CTZUNIqGY",
)
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Map<String, Object> retrieveParams =
new HashMap<>();
List<String> expandList = new ArrayList<>();
expandList.add("sources");
retrieveParams.put("expand", expandList);
Customer customer =
Customer.retrieve(
"cus_AJ6yA7mRH34mJT",
retrieveParams,
null
);
Card card =
(Card) customer.getSources().retrieve(
"card_1JxAnQ2eZvKYlo2CSHJgfO7D"
);
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const card = await payske.customers.retrieveSource(
'cus_AJ6yA7mRH34mJT',
'card_1JxAxn2eZvKYlo2CKrTu5IxA'
);
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.CardParams{
Customer: payske.String("cus_AJ6yA7mRH34mJT"),
}
c, _ := card.Get(
"card_1JxB9E2eZvKYlo2C1dC8gPvE",
params,
)
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var service = new CardService();
service.Get(
"cus_AJ6yA7mRH34mJT",
"card_1JxX3a2eZvKYlo2CAgnJq5yN"
);
Response
{
"id": "card_1Jwvx22eZvKYlo2C7q732luw",
"object": "card",
"address_city": null,
"address_country": null,
"address_line1": null,
"address_line1_check": null,
"address_line2": null,
"address_state": null,
"address_zip": null,
"address_zip_check": null,
"brand": "Visa",
"country": "US",
"customer": "cus_AJ6yA7mRH34mJT",
"cvc_check": "pass",
"dynamic_last4": null,
"exp_month": 8,
"exp_year": 2022,
"fingerprint": "Xt5EWLLDS7FJjR1c",
"funding": "credit",
"last4": "4242",
"metadata": {},
"name": null,
"tokenization_method": null
}
You can always see the 10 most recent cards directly on a customer; this method lets you retrieve details about a specific card stored on the customer.
Parameters
No parameters.
Returns
Returns the Card
object.
Update a card
POST /v1/customers/:id/sources/:id
curl https://api.payske.com/v1/customers/cus_AJ6yA7mRH34mJT/sources/card_1JxXlk2eZvKYlo2CxxLhecjw \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d name="Jenny Rosen"
$payske = new \Payske\PayskeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$payske->customers->updateSource(
'cus_AJ6yA7mRH34mJT',
'card_1Jx9xt2eZvKYlo2CmDZcDDHY',
['name' => 'Jenny Rosen']
);
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Customer.update_source(
'cus_AJ6yA7mRH34mJT',
'card_1JxAEM2eZvKYlo2CaqgYB2xk',
{name: 'Jenny Rosen'},
)
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Customer.modify_source(
"cus_AJ6yA7mRH34mJT",
"card_1JxAYt2eZvKYlo2CTZUNIqGY",
name="Jenny Rosen",
)
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Map<String, Object> retrieveParams =
new HashMap<>();
List<String> expandList = new ArrayList<>();
expandList.add("sources");
retrieveParams.put("expand", expandList);
Customer customer =
Customer.retrieve(
"cus_AJ6yA7mRH34mJT",
retrieveParams,
null
);
Card card =
customer.getSources().retrieve(
"card_1JxAnQ2eZvKYlo2CSHJgfO7D"
);
Map<String, Object> params = new HashMap<>();
params.put("name", "Jenny Rosen");
Card updatedCard = (Card) card.update(params);
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const card = await payske.customers.updateSource(
'cus_AJ6yA7mRH34mJT',
'card_1JxAxn2eZvKYlo2CKrTu5IxA',
{name: 'Jenny Rosen'}
);
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.CardParams{
Customer: payske.String("cus_AJ6yA7mRH34mJT"),
Name: payske.String("Jenny Rosen"),
}
c, _ := card.Update(
"card_1JxB9E2eZvKYlo2C1dC8gPvE",
params,
)
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new CardUpdateOptions
{
Name = "Jenny Rosen",
};
var service = new CardService();
service.Update(
"cus_AJ6yA7mRH34mJT",
"card_1JxX3a2eZvKYlo2CAgnJq5yN",
options
);
Response
{
"id": "card_1Jwvx22eZvKYlo2C7q732luw",
"object": "card",
"address_city": null,
"address_country": null,
"address_line1": null,
"address_line1_check": null,
"address_line2": null,
"address_state": null,
"address_zip": null,
"address_zip_check": null,
"brand": "Visa",
"country": "US",
"customer": "cus_AJ6yA7mRH34mJT",
"cvc_check": "pass",
"dynamic_last4": null,
"exp_month": 8,
"exp_year": 2022,
"fingerprint": "Xt5EWLLDS7FJjR1c",
"funding": "credit",
"last4": "4242",
"metadata": {},
"name": "Jenny Rosen",
"tokenization_method": null
}
If you need to update only some card details, like the billing address or expiration date, you can do so without having to re-enter the full card details. Also, Payske works directly with card networks so that your customers can continue using your service without interruption.
When you update a card, Payske typically validates the card automatically. For more details, see Check if a card is valid without a charge.
Parameters
address_city optional
City/District/Suburb/Town/Village.
address_country optional
Billing address country, if provided when creating card.
address_line1 optional
Address line 1 (Street address/PO Box/Company name).
address_line2 optional
Address line 2 (Apartment/Suite/Unit/Building).
address_state optional
State/County/Province/Region.
address_zip optional
ZIP or postal code.
exp_month optional
Two digit number representing the card’s expiration month.
exp_year optional
Four digit number representing the card’s expiration year.
metadata optional dictionary
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to
metadata
.name optional
Cardholder name.
Returns
Returns the Card
object.
Delete a card
DELETE /v1/customers/:id/sources/:id
curl https://api.payske.com/v1/customers/cus_AJ6yA7mRH34mJT/sources/card_1Jwvx22eZvKYlo2C7q732luw \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-X DELETE
$payske = new \Payske\PayskeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$payske->customers->deleteSource(
'cus_AJ6yA7mRH34mJT',
'card_1Jx9xt2eZvKYlo2CmDZcDDHY',
[]
);
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Customer.delete_source(
'cus_AJ6yA7mRH34mJT',
'card_1JxAEM2eZvKYlo2CaqgYB2xk',
)
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Customer.delete_source(
"cus_AJ6yA7mRH34mJT",
"card_1JxAYt2eZvKYlo2CTZUNIqGY",
)
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Map<String, Object> retrieveParams =
new HashMap<>();
List<String> expandList = new ArrayList<>();
expandList.add("sources");
retrieveParams.put("expand", expandList);
Customer customer =
Customer.retrieve(
"cus_AJ6yA7mRH34mJT",
retrieveParams,
null
);
Card card =
customer.getSources().retrieve(
"card_1JxAnQ2eZvKYlo2CSHJgfO7D"
);
Card deletedCard = (Card) card.delete();
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const deleted = await payske.customers.deleteSource(
'cus_AJ6yA7mRH34mJT',
'card_1JxAxn2eZvKYlo2CKrTu5IxA'
);
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.CardParams{
Customer: payske.String("cus_AJ6yA7mRH34mJT"),
}
c, _ := card.Del(
"card_1JxB9E2eZvKYlo2C1dC8gPvE",
params,
)
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var service = new CardService();
service.Delete(
"cus_AJ6yA7mRH34mJT",
"card_1JxX3a2eZvKYlo2CAgnJq5yN"
);
Response
{
"id": "card_1Jwvx22eZvKYlo2C7q732luw",
"object": "card",
"deleted": true
}
You can delete cards from a customer.
If you delete a card that is currently the default source, then the most recently added source will become the new default. If you delete a card that is the last remaining source on the customer, then the default_source
attribute will become null.
For recipients: if you delete the default card, then the most recently added card will become the new default. If you delete the last remaining card on a recipient, then the default_card
attribute will become null.
Note that for cards belonging to customers, you might want to prevent customers on paid subscriptions from deleting all cards on file, so that there is at least one default card for the next invoice payment attempt.
Parameters
No parameters.
Returns
Returns the deleted Card
object.
List all cards
GET /v1/customers/:id/sources?object=card
curl https://api.payske.com/v1/customers/cus_AJ6yA7mRH34mJT/sources \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d object=card \
-d limit=3 \
-G
$payske = new \Payske\PayskeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$payske->customers->allSources(
'cus_AJ6yA7mRH34mJT',
['object' => 'card', 'limit' => 3]
);
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Customer.list_sources(
'cus_AJ6yA7mRH34mJT',
{object: 'card', limit: 3},
)
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Customer.list_sources(
"cus_AJ6yA7mRH34mJT",
object="card",
limit=3,
)
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
List<String> expandList = new ArrayList<>();
expandList.add("sources");
Map<String, Object> retrieveParams = new HashMap<>();
retrieveParams.put("expand", expandList);
Customer customer =
Customer.retrieve(
"cus_AJ6yA7mRH34mJT",
retrieveParams,
null
);
Map<String, Object> params = new HashMap<>();
params.put("object", "card");
params.put("limit", 3);
PaymentSourceCollection cards =
customer.getSources().list(params);
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const cards = await payske.customers.listSources(
'cus_AJ6yA7mRH34mJT',
{object: 'card', limit: 3}
);
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.CardListParams{
Customer: payske.String("cus_AJ6yA7mRH34mJT"),
}
params.Filters.AddFilter("limit", "", "3")
i := card.List(params)
for i.Next() {
c := i.Card()
}
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var service = new CardService();
var options = new CardListOptions
{
Limit = 3,
};
var cards = service.List("cus_AJ6yA7mRH34mJT", options);
Response
{
"object": "list",
"url": "/v1/customers/cus_AJ6yA7mRH34mJT/sources",
"has_more": false,
"data": [
{
"id": "card_1Jwvx22eZvKYlo2C7q732luw",
"object": "card",
"address_city": null,
"address_country": null,
"address_line1": null,
"address_line1_check": null,
"address_line2": null,
"address_state": null,
"address_zip": null,
"address_zip_check": null,
"brand": "Visa",
"country": "US",
"customer": "cus_AJ6yA7mRH34mJT",
"cvc_check": "pass",
"dynamic_last4": null,
"exp_month": 8,
"exp_year": 2022,
"fingerprint": "Xt5EWLLDS7FJjR1c",
"funding": "credit",
"last4": "4242",
"metadata": {},
"name": null,
"tokenization_method": null
},
{...},
{...}
]
}
You can see a list of the cards belonging to a customer. Note that the 10 most recent sources are always available on the Customer
object. If you need more than those 10, you can use this API method and the limit
and starting_after
parameters to page through additional cards.
ParametersCollapse all
ending_before optional
A cursor for use in pagination.
ending_before
is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting withobj_bar
, your subsequent call can includeending_before=obj_bar
in order to fetch the previous page of the list.limit optional
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
starting_after optional
A cursor for use in pagination.
starting_after
is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending withobj_foo
, your subsequent call can includestarting_after=obj_foo
in order to fetch the next page of the list.
Returns
Returns a list of the cards stored on the customer.
Bank Accounts
These bank accounts are payment methods on Customer
objects.
On the other hand External Accounts are transfer destinations on Account
objects for Custom accounts. They can be bank accounts or debit cards as well, and are documented in the links above.
Related guide: Bank Debits and Transfers.
Was this section helpful?YesNo
The bank account object
The bank account object
{
"id": "ba_1Jw9mB2eZvKYlo2Crly03Iir",
"object": "bank_account",
"account_holder_name": "Test",
"account_holder_type": "individual",
"account_type": null,
"bank_name": "PAYSKE TEST BANK",
"country": "US",
"currency": "usd",
"customer": null,
"fingerprint": "OHMI60oSIPAmj91c",
"last4": "9991",
"metadata": {},
"routing_number": "110000000",
"status": "new"
}
Attributes
id string
Unique identifier for the object.
account_holder_name string
The name of the person or business that owns the bank account.
account_holder_type string
The type of entity that holds the account. This can be either
individual
orcompany
.bank_name string
Name of the bank associated with the routing number (e.g.,
WELLS FARGO
).country string
Two-letter ISO code representing the country the bank account is located in.
currency currency
Three-letter ISO code for the currency paid out to the bank account.
customer string
The ID of the customer that the bank account is associated with.
fingerprint string
Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same.
last4 string
The last four digits of the bank account number.
metadata hash
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
routing_number string
The routing transit number for the bank account.
More attributesCollapse all
object string, value is "bank_account"
String representing the object’s type. Objects of the same type share the same value.
account string
The ID of the account that the bank account is associated with.
account_type string
The bank account type. This can only be
checking
orsavings
in most countries. In Japan, this can only befutsu
ortoza
.available_payout_methods array
A set of available payout methods for this bank account. Only values from this set should be passed as the
method
when creating a payout.status string
For bank accounts, possible values are
new
,validated
,verified
,verification_failed
, orerrored
. A bank account that hasn’t had any activity or validation performed isnew
. If Payske can determine that the bank account exists, its status will bevalidated
. Note that there often isn’t enough information to know (e.g., for smaller credit unions), and the validation is not always run. If customer bank account verification has succeeded, the bank account status will beverified
. If the verification failed for any reason, such as microdeposit failure, the status will beverification_failed
. If a transfer sent to this bank account fails, we’ll set the status toerrored
and will not continue to send transfers until the bank details are updated.For external accounts, possible values are
new
anderrored
. Validations aren’t run against external accounts because they’re only used for payouts. This means the other statuses don’t apply. If a transfer fails, the status is set toerrored
and transfers are stopped until account details are updated.
Create a bank account
POST /v1/customers/:id/sources
curl https://api.payske.com/v1/customers/cus_AJ6yA7mRH34mJT/sources \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d source=btok_1JxXll2eZvKYlo2CLhqmB5Vy
$payske = new \Payske\PayskeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$payske->customers->createSource(
'cus_AJ6yA7mRH34mJT',
['source' => 'btok_1Jx9xv2eZvKYlo2C4JOF8wog']
);
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Customer.create_source(
'cus_AJ6yA7mRH34mJT',
{source: 'btok_1JxAEN2eZvKYlo2C7wybqDU9'},
)
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Customer.create_source(
"cus_AJ6yA7mRH34mJT",
source="btok_1JxAYu2eZvKYlo2CrWCWPacg",
)
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Map<String, Object> retrieveParams =
new HashMap<>();
List<String> expandList = new ArrayList<>();
expandList.add("sources");
retrieveParams.put("expand", expandList);
Customer customer =
Customer.retrieve(
"cus_AJ6yA7mRH34mJT",
retrieveParams,
null
);
Map<String, Object> params = new HashMap<>();
params.put(
"source",
"btok_1JxAnS2eZvKYlo2CEKl2cZsq"
);
BankAccount bankAccount =
(BankAccount) customer.getSources().create(
params
);
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const bankAccount = await payske.customers.createSource(
'cus_AJ6yA7mRH34mJT',
{source: 'btok_1JxAxp2eZvKYlo2CvoWN3QYC'}
);
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.BankAccountParams{
Customer: payske.String("cus_AJ6yA7mRH34mJT"),
Token: payske.String("btok_1JxB9F2eZvKYlo2CTkTlVpHt"),
}
ba, err := bankaccount.New(params)
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new BankAccountCreateOptions
{
Source = "btok_1JxX3c2eZvKYlo2COQEIreia",
};
var service = new BankAccountService();
service.Create("cus_AJ6yA7mRH34mJT", options);
Response
{
"id": "ba_1Jw9mB2eZvKYlo2Crly03Iir",
"object": "bank_account",
"account_holder_name": "Test",
"account_holder_type": "individual",
"account_type": null,
"bank_name": "PAYSKE TEST BANK",
"country": "US",
"currency": "usd",
"customer": "cus_AJ6yA7mRH34mJT",
"fingerprint": "OHMI60oSIPAmj91c",
"last4": "9991",
"metadata": {},
"routing_number": "110000000",
"status": "new"
}
When you create a new bank account, you must specify a Customer
object on which to create it.
Parameters
source required
Either a token, like the ones returned by Payske.js, or a dictionary containing a user’s bank account details (with the options shown below).
Hide child parameters
source.object required
The type of external account. Should be
bank_account
.source.country required
The country in which the bank account is located.
source.currency required
The currency the bank account is in. This must be a country/currency pairing that Payske supports.
source.account_holder_name optional
The name of the person or business that owns the bank account. This field is required when attaching the bank account to a
Customer
object.source.account_holder_type optional
The type of entity that holds the account. This can be either
individual
orcompany
. This field is required when attaching the bank account to aCustomer
object.source.routing_number optional
The routing number, sort code, or other country-appropriate institution number for the bank account. For US bank accounts, this is required and should be the ACH routing number, not the wire routing number. If you are providing an IBAN for
account_number
, this field is not required.source.account_number required
The account number for the bank account, in string form. Must be a checking account.
metadata optional dictionary
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to
metadata
.
Returns
Returns the bank account object.
Retrieve a bank account
GET /v1/customers/:id/sources/:id
curl https://api.payske.com/v1/customers/cus_AJ6yA7mRH34mJT/sources/ba_1JxV1W2eZvKYlo2CZurl1Ki6 \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc:
$payske = new \Payske\PayskeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$payske->customers->retrieveSource(
'cus_AJ6yA7mRH34mJT',
'ba_1Jx9a92eZvKYlo2CqCR7gerB',
[]
);
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Customer.retrieve_source(
'cus_AJ6yA7mRH34mJT',
'ba_1Jx9a92eZvKYlo2CqCR7gerB',
)
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Customer.retrieve_source(
"cus_AJ6yA7mRH34mJT",
"ba_1Jx9a92eZvKYlo2CqCR7gerB",
)
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Map<String, Object> retrieveParams =
new HashMap<>();
List<String> expandList = new ArrayList<>();
expandList.add("sources");
retrieveParams.put("expand", expandList);
Customer customer =
Customer.retrieve(
"cus_AJ6yA7mRH34mJT",
retrieveParams,
null
);
BankAccount bankAccount =
(BankAccount) customer.getSources().retrieve(
"ba_1Jx9a92eZvKYlo2CqCR7gerB"
);
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const bankAccount = await payske.customers.retrieveSource(
'cus_AJ6yA7mRH34mJT',
'ba_1Jx9a92eZvKYlo2CqCR7gerB'
);
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.BankAccountParams{
Customer: payske.String("cus_AJ6yA7mRH34mJT"),
}
ba, _ := bankaccount.Get(
"ba_1JxB8R2eZvKYlo2CqSBL9hKS",
params,
)
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var service = new BankAccountService();
service.Get(
"cus_AJ6yA7mRH34mJT",
"ba_1JxV1W2eZvKYlo2CZurl1Ki6"
);
Response
{
"id": "ba_1Jw9mB2eZvKYlo2Crly03Iir",
"object": "bank_account",
"account_holder_name": "Test",
"account_holder_type": "individual",
"account_type": null,
"bank_name": "PAYSKE TEST BANK",
"country": "US",
"currency": "usd",
"customer": "cus_AJ6yA7mRH34mJT",
"fingerprint": "OHMI60oSIPAmj91c",
"last4": "9991",
"metadata": {},
"routing_number": "110000000",
"status": "new"
}
By default, you can see the 10 most recent sources stored on a Customer directly on the object, but you can also retrieve details about a specific bank account stored on the Payske account.
Parameters
No parameters.
Returns
Returns the bank account object.
Update a bank account
POST /v1/customers/:id/sources/:id
curl https://api.payske.com/v1/customers/cus_AJ6yA7mRH34mJT/sources/ba_1JxV1W2eZvKYlo2CZurl1Ki6 \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d "metadata[order_id]"=6735
$payske = new \Payske\PayskeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$payske->customers->updateSource(
'cus_AJ6yA7mRH34mJT',
'ba_1Jx9a92eZvKYlo2CqCR7gerB',
['metadata' => ['order_id' => '6735']]
);
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Customer.update_source(
'cus_AJ6yA7mRH34mJT',
'ba_1Jx9a92eZvKYlo2CqCR7gerB',
{metadata: {order_id: '6735'}},
)
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Customer.modify_source(
"cus_AJ6yA7mRH34mJT",
"ba_1Jx9a92eZvKYlo2CqCR7gerB",
metadata={"order_id": "6735"},
)
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Map<String, Object> retrieveParams =
new HashMap<>();
List<String> expandList = new ArrayList<>();
expandList.add("sources");
retrieveParams.put("expand", expandList);
Customer customer =
Customer.retrieve(
"cus_AJ6yA7mRH34mJT",
retrieveParams,
null
);
BankAccount bankAccount =
customer.getSources().retrieve(
"ba_1Jx9a92eZvKYlo2CqCR7gerB"
);
Map<String, Object> metadata = new HashMap<>();
metadata.put("order_id", "6735");
Map<String, Object> params = new HashMap<>();
params.put("metadata", metadata);
BankAccount updatedBankAccount =
(BankAccount) bankAccount.update(params);
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const bankAccount = await payske.customers.updateSource(
'cus_AJ6yA7mRH34mJT',
'ba_1Jx9a92eZvKYlo2CqCR7gerB',
{metadata: {order_id: '6735'}}
);
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.BankAccountParams{
Customer: payske.String("cus_AJ6yA7mRH34mJT"),
}
params.AddMetadata("order_id", "6735")
ba, _ := bankaccount.Update(
"ba_1JxB8R2eZvKYlo2CqSBL9hKS",
params,
)
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new BankAccountUpdateOptions
{
Metadata = new Dictionary<string, string>
{
{ "order_id", "6735" },
},
};
var service = new BankAccountService();
service.Update(
"cus_AJ6yA7mRH34mJT",
"ba_1JxV1W2eZvKYlo2CZurl1Ki6",
options
);
Response
{
"id": "ba_1Jw9mB2eZvKYlo2Crly03Iir",
"object": "bank_account",
"account_holder_name": "Test",
"account_holder_type": "individual",
"account_type": null,
"bank_name": "PAYSKE TEST BANK",
"country": "US",
"currency": "usd",
"customer": "cus_AJ6yA7mRH34mJT",
"fingerprint": "OHMI60oSIPAmj91c",
"last4": "9991",
"metadata": {
"order_id": "6735"
},
"routing_number": "110000000",
"status": "new"
}
Updates the account_holder_name
, account_holder_type
, and metadata
of a bank account belonging to a customer. Other bank account details are not editable, by design.
Parameters
account_holder_name optional
The name of the person or business that owns the bank account.
account_holder_type optional
The type of entity that holds the account. This can be either
individual
orcompany
.metadata optional dictionary
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to
metadata
.
Returns
Returns the bank account object.
List all bank accounts
GET /v1/customers/:id/sources?object=bank_account
curl https://api.payske.com/v1/customers/cus_AJ6yA7mRH34mJT/sources \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d object=bank_account \
-d limit=3 \
-G
$payske = new \Payske\PayskeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$payske->customers->allSources(
'cus_AJ6yA7mRH34mJT',
['object' => 'bank_account', 'limit' => 3]
);
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Customer.list_sources(
'cus_AJ6yA7mRH34mJT',
{object: 'bank_account', limit: 3},
)
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Customer.list_sources(
"cus_AJ6yA7mRH34mJT",
object="bank_account",
limit=3,
)
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Map<String, Object> retrieveParams =
new HashMap<>();
List<String> expandList = new ArrayList<>();
expandList.add("sources");
retrieveParams.put("expand", expandList);
Customer customer =
Customer.retrieve(
"cus_AJ6yA7mRH34mJT",
retrieveParams,
null
);
Map<String, Object> params = new HashMap<>();
params.put("object", "bank_account");
params.put("limit", 3);
PaymentSourceCollection bankAccounts =
customer.getSources().list(params);
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const bankAccounts = await payske.customers.listSources(
'cus_AJ6yA7mRH34mJT',
{object: 'bank_account', limit: 3}
);
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.BankAccountListParams{
Customer: payske.String("cus_AJ6yA7mRH34mJT"),
}
params.Filters.AddFilter("limit", "", "3")
i := bankaccount.List(params)
for i.Next() {
ba := i.BankAccount()
}
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new BankAccountListOptions
{
Limit = 3,
};
var service = new BankAccountService();
var bankAccounts = service.List("cus_AJ6yA7mRH34mJT", options);
Response
{
"object": "list",
"url": "/v1/customers/cus_AJ6yA7mRH34mJT/sources",
"has_more": false,
"data": [
{
"id": "ba_1Jw9mB2eZvKYlo2Crly03Iir",
"object": "bank_account",
"account_holder_name": "Test",
"account_holder_type": "individual",
"account_type": null,
"bank_name": "PAYSKE TEST BANK",
"country": "US",
"currency": "usd",
"customer": "cus_AJ6yA7mRH34mJT",
"fingerprint": "OHMI60oSIPAmj91c",
"last4": "9991",
"metadata": {},
"routing_number": "110000000",
"status": "new"
},
{...},
{...}
]
}
You can see a list of the bank accounts belonging to a Customer. Note that the 10 most recent sources are always available by default on the Customer. If you need more than those 10, you can use this API method and the limit
and starting_after
parameters to page through additional bank accounts.
Parameters
ending_before optional
A cursor for use in pagination.
ending_before
is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting withobj_bar
, your subsequent call can includeending_before=obj_bar
in order to fetch the previous page of the list.limit optional
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
starting_after optional
A cursor for use in pagination.
starting_after
is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending withobj_foo
, your subsequent call can includestarting_after=obj_foo
in order to fetch the next page of the list.
Returns
Returns a list of the bank accounts stored on the customer.
Sessions
A Checkout Session represents your customer's session as they pay for one-time purchases or subscriptions through Checkout or Payment Links. We recommend creating a new Session each time your customer attempts to pay.
Once payment is successful, the Checkout Session will contain a reference to the Customer, and either the successful PaymentIntent or an active Subscription.
You can create a Checkout Session on your server and pass its ID to the client to begin Checkout.
Related guide: Checkout Server Quickstart.
Was this section helpful? Yes No
The Session object
The Session object
{
"id": "cs_test_9JAHiKx2kgFg2Snc5Gnop1iNIgawrLGBlo3XBXfWfEicPzx9oXBcytyz",
"object": "checkout.session",
"after_expiration": null,
"allow_promotion_codes": null,
"amount_subtotal": null,
"amount_total": null,
"automatic_tax": {
"enabled": false,
"status": null
},
"billing_address_collection": null,
"cancel_url": "https://example.com/cancel",
"client_reference_id": null,
"consent": null,
"consent_collection": null,
"currency": null,
"customer": null,
"customer_details": null,
"customer_email": null,
"expires_at": 1637227692,
"livemode": false,
"locale": null,
"metadata": {},
"mode": "payment",
"payment_intent": "pi_1DpdOt2eZvKYlo2CFOGrwsj4",
"payment_method_options": {},
"payment_method_types": [
"card"
],
"payment_status": "unpaid",
"phone_number_collection": {
"enabled": false
},
"recovered_from": null,
"setup_intent": null,
"shipping": null,
"shipping_address_collection": null,
"shipping_options": [],
"shipping_rate": null,
"status": "expired",
"submit_type": null,
"subscription": null,
"success_url": "https://example.com/success",
"total_details": null,
"url": null
}
Attributes
id string
Unique identifier for the object. Used to pass to
redirectToCheckout
in Payske.js.cancel_url string
The URL the customer will be directed to if they decide to cancel payment and return to your website.
client_reference_id string
A unique string to reference the Checkout Session. This can be a customer ID, a cart ID, or similar, and can be used to reconcile the Session with your internal systems.
currency currency
Three-letter ISO currency code, in lowercase. Must be a supported currency.
customer string
The ID of the customer for this Session. For Checkout Sessions in
payment
orsubscription
mode, Checkout will create a new customer object based on information provided during the payment flow unless an existing customer was provided when the Session was created.customer_email string
If provided, this value will be used when the Customer object is created. If not provided, customers will be asked to enter their email address. Use this parameter to prefill customer data if you already have an email on file. To access information about the customer once the payment flow is complete, use the
customer
attribute.line_items list expandable
The line items purchased by the customer.
This field is not included by default. To include it in the response, expand the
line_items
field.Show child attributes
metadata hash
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
mode enum
The mode of the Checkout Session.
Possible enum values
payment
Accept one-time payments for cards, iDEAL, and more.
setup
Save payment details to charge your customers later.
subscription
Use Payske Billing to set up fixed-price subscriptions.
payment_intent string
The ID of the PaymentIntent for Checkout Sessions in
payment
mode.payment_method_types array containing strings
A list of the types of payment methods (e.g. card) this Checkout Session is allowed to accept.
payment_status enum
The payment status of the Checkout Session, one of
paid
,unpaid
, orno_payment_required
. You can use this value to decide when to fulfill your customer’s order.Possible enum values
paid
The payment funds are available in your account.
unpaid
The payment funds are not yet available in your account.
no_payment_required
The Checkout Session is in
setup
mode and doesn’t require a payment at this time.
success_url string
The URL the customer will be directed to after the payment or subscription creation is successful.
More attributesCollapse all
object string, value is "checkout.session"
String representing the object’s type. Objects of the same type share the same value.
after_expiration hash
When set, provides configuration for actions to take if this Checkout Session expires.
Hide child attributes
after_expiration.recovery hash
When set, configuration used to recover the Checkout Session on expiry.
Hide child attributes
after_expiration.recovery.allow_promotion_codes boolean
Enables user redeemable promotion codes on the recovered Checkout Sessions. Defaults to
false
after_expiration.recovery.enabled boolean
If
true
, a recovery url will be generated to recover this Checkout Session if it expires before a transaction is completed. It will be attached to the Checkout Session object upon expiration.after_expiration.recovery.expires_at timestamp
The timestamp at which the recovery URL will expire.
after_expiration.recovery.url string
URL that creates a new Checkout Session when clicked that is a copy of this expired Checkout Session
allow_promotion_codes boolean
Enables user redeemable promotion codes.
amount_subtotal integer
Total of all items before discounts or taxes are applied.
amount_total integer
Total of all items after discounts and taxes are applied.
automatic_tax hash
Details on the state of automatic tax for the session, including the status of the latest tax calculation.
Hide child attributes
automatic_tax.enabled boolean
Indicates whether automatic tax is enabled for the session
automatic_tax.status enum
The status of the most recent automated tax calculation for this session.
Possible enum values
requires_location_inputs
The location details entered by the customer aren’t valid or don’t provide enough location information to accurately determine tax rates.
complete
Payske successfully calculated tax automatically for this session.
failed
The Payske Tax service failed.
billing_address_collection enum
Describes whether Checkout should collect the customer’s billing address.
Possible enum values
auto
DefaultCheckout will only collect the billing address when necessary.
required
Checkout will always collect the customer’s billing address.
consent hash
Results of
consent_collection
for this session.Hide child attributes
consent_collection hash
When set, provides configuration for the Checkout Session to gather active consent from customers.
Hide child attributes
consent_collection.promotions string
If set to
auto
, enables the collection of customer consent for promotional communications. The Checkout Session will determine whether to display an option to opt into promotional communication from the merchant depending on the customer’s locale. Only available to US merchants.
customer_details hash
The customer details including the customer’s tax exempt status and the customer’s tax IDs. Only present on Sessions in
payment
orsubscription
mode.Hide child attributes
customer_details.email string
The email associated with the Customer, if one exists, on the Checkout Session at the time of checkout or at time of session expiry. Otherwise, if the customer has consented to promotional content, this value is the most recent valid email provided by the customer on the Checkout form.
customer_details.phone string
The customer’s phone number at the time of checkout
customer_details.tax_exempt string
The customer’s tax exempt status at time of checkout.
customer_details.tax_ids array of hashes
The customer’s tax IDs at time of checkout.
Hide child attributes
customer_details.tax_ids.type string
The type of the tax ID, one of
eu_vat
,br_cnpj
,br_cpf
,gb_vat
,nz_gst
,au_abn
,au_arn
,in_gst
,no_vat
,za_vat
,ch_vat
,mx_rfc
,sg_uen
,ru_inn
,ru_kpp
,ca_bn
,hk_br
,es_cif
,tw_vat
,th_vat
,jp_cn
,jp_rn
,li_uid
,my_itn
,us_ein
,kr_brn
,ca_qst
,ca_gst_hst
,ca_pst_bc
,ca_pst_mb
,ca_pst_sk
,my_sst
,sg_gst
,ae_trn
,cl_tin
,sa_vat
,id_npwp
,my_frp
,il_vat
, orunknown
customer_details.tax_ids.value string
The value of the tax ID.
expires_at timestamp
The timestamp at which the Checkout Session will expire.
livemode boolean
Has the value
true
if the object exists in live mode or the valuefalse
if the object exists in test mode.locale enum
The IETF language tag of the locale Checkout is displayed in. If blank or
auto
, the browser’s locale is used.Possible enum values
auto
bg
cs
da
de
el
en
- Show 34 more
payment_method_options hash
Payment-method-specific configuration for the PaymentIntent or SetupIntent of this CheckoutSession.
Hide child attributes
payment_method_options.acss_debit hash
If the Checkout Session’s payment_method_types includes
acss_debit
, this hash contains the configurations that will be applied to each payment attempt of that type.Hide child attributes
payment_method_options.acss_debit.currency enum
Currency supported by the bank account. Returned when the Session is in
setup
mode.Possible enum values
cad
Canadian dollars
usd
US dollars
payment_method_options.acss_debit.mandate_options hash
Additional fields for Mandate creation
Show child attributes
payment_method_options.acss_debit.verification_method enum
Bank account verification method.
Possible enum values
automatic
Instant verification with fallback to microdeposits.
instant
Instant verification.
microdeposits
Verification using microdeposits.
payment_method_options.boleto hash
If the Checkout Session’s payment_method_types includes
boleto
, this hash contains the configurations that will be applied to each payment attempt of that type.Show child attributes
payment_method_options.oxxo hash
If the Checkout Session’s payment_method_types includes
oxxo
, this hash contains the configurations that will be applied to each payment attempt of that type.Show child attributes
phone_number_collection hash
Details on the state of phone number collection for the session.
Hide child attributes
recovered_from string
The ID of the original expired Checkout Session that triggered the recovery flow.
setup_intent string
The ID of the SetupIntent for Checkout Sessions in
setup
mode.shipping hash
Shipping information for this Checkout Session.
Hide child attributes
shipping.address hash
Shipping address.
Hide child attributes
shipping.address.city string
City, district, suburb, town, or village.
shipping.address.country string
Two-letter country code (ISO 3166-1 alpha-2).
shipping.address.line1 string
Address line 1 (e.g., street, PO Box, or company name).
shipping.address.line2 string
Address line 2 (e.g., apartment, suite, unit, or building).
shipping.address.postal_code string
ZIP or postal code.
shipping.address.state string
State, county, province, or region.
shipping.name string
Recipient name.
shipping_address_collection hash
When set, provides configuration for Checkout to collect a shipping address from a customer.
Hide child attributes
shipping_address_collection.allowed_countries array of enum values
An array of two-letter ISO country codes representing which countries Checkout should provide as options for shipping locations. Unsupported country codes:
AS, CX, CC, CU, HM, IR, KP, MH, FM, NF, MP, PW, SD, SY, UM, VI
.Possible enum values
AC
AD
AE
AF
AG
AI
AL
AM
AO
AQ
AR
AT
AU
AW
AX
AZ
BA
BB
BD
BE
BF
BG
BH
BI
BJ
BL
BM
BN
BO
BQ
BR
BS
BT
BV
BW
BY
BZ
CA
CD
CF
CG
CH
CI
CK
CL
CM
CN
CO
CR
CV
CW
CY
CZ
DE
DJ
DK
DM
DO
DZ
EC
EE
EG
EH
ER
ES
ET
FI
FJ
FK
FO
FR
GA
GB
GD
GE
GF
GG
GH
GI
GL
GM
GN
GP
GQ
GR
GS
GT
GU
GW
GY
HK
HN
HR
HT
HU
ID
IE
IL
IM
IN
IO
IQ
IS
IT
JE
JM
JO
JP
KE
KG
KH
KI
KM
KN
KR
KW
KY
KZ
LA
LB
LC
LI
LK
LR
LS
LT
LU
LV
LY
MA
MC
MD
ME
MF
MG
MK
ML
MM
MN
MO
MQ
MR
MS
MT
MU
MV
MW
MX
MY
MZ
NA
NC
NE
NG
NI
NL
NO
NP
NR
NU
NZ
OM
PA
PE
PF
PG
PH
PK
PL
PM
PN
PR
PS
PT
PY
QA
RE
RO
RS
RU
RW
SA
SB
SC
SE
SG
SH
SI
SJ
SK
SL
SM
SN
SO
SR
SS
ST
SV
SX
SZ
TA
TC
TD
TF
TG
TH
TJ
TK
TL
TM
TN
TO
TR
TT
TV
TW
TZ
UA
UG
US
UY
UZ
VA
VC
VE
VG
VN
VU
WF
WS
XK
YE
YT
ZA
ZM
ZW
ZZ
shipping_options array of hashes
The shipping rate options applied to this Session.
Hide child attributes
shipping_rate string
The ID of the ShippingRate for Checkout Sessions in
payment
mode.status enum
The status of the Checkout Session, one of
open
,complete
, orexpired
.Possible enum values
open
The checkout session is still in progress. Payment processing has not started
complete
The checkout session is complete. Payment processing may still be in progress
expired
The checkout session has expired. No further processing will occur
submit_type enum
Describes the type of transaction being performed by Checkout in order to customize relevant text on the page, such as the submit button.
submit_type
can only be specified on Checkout Sessions inpayment
mode, but not Checkout Sessions insubscription
orsetup
mode.Possible enum values
auto
pay
book
donate
subscription string
The ID of the subscription for Checkout Sessions in
subscription
mode.tax_id_collection hash
Details on the state of tax ID collection for the session.
Hide child attributes
total_details hash
Tax and discount details for the computed total amount.
Hide child attributes
total_details.amount_discount integer
This is the sum of all the line item discounts.
total_details.amount_shipping integer
This is the sum of all the line item shipping amounts.
total_details.amount_tax integer
This is the sum of all the line item tax amounts.
total_details.breakdown hash expandable
Breakdown of individual tax and discount amounts that add up to the totals.
This field is not included by default. To include it in the response, expand the
breakdown
field.Hide child attributes
total_details.breakdown.discounts array of hashes
The aggregated line item discounts.
Hide child attributes
total_details.breakdown.discounts.amount integer
The amount discounted.
total_details.breakdown.discounts.discount hash, discount object
The discount applied.
total_details.breakdown.taxes array of hashes
The aggregated line item tax amounts by rate.
Hide child attributes
total_details.breakdown.taxes.amount integer
Amount of tax applied for this rate.
total_details.breakdown.taxes.rate hash
The tax rate applied.
Hide child attributes
total_details.breakdown.taxes.rate.id string
Unique identifier for the object.
total_details.breakdown.taxes.rate.object string, value is "tax_rate"
String representing the object’s type. Objects of the same type share the same value.
total_details.breakdown.taxes.rate.active boolean
Defaults to
true
. When set tofalse
, this tax rate cannot be used with new applications or Checkout Sessions, but will still work for subscriptions and invoices that already have it set.total_details.breakdown.taxes.rate.country string
Two-letter country code (ISO 3166-1 alpha-2).
total_details.breakdown.taxes.rate.created timestamp
Time at which the object was created. Measured in seconds since the Unix epoch.
total_details.breakdown.taxes.rate.description string
An arbitrary string attached to the tax rate for your internal use only. It will not be visible to your customers.
total_details.breakdown.taxes.rate.display_name string
The display name of the tax rates as it will appear to your customer on their receipt email, PDF, and the hosted invoice page.
total_details.breakdown.taxes.rate.inclusive boolean
This specifies if the tax rate is inclusive or exclusive.
total_details.breakdown.taxes.rate.jurisdiction string
The jurisdiction for the tax rate. You can use this label field for tax reporting purposes. It also appears on your customer’s invoice.
total_details.breakdown.taxes.rate.livemode boolean
Has the value
true
if the object exists in live mode or the valuefalse
if the object exists in test mode.total_details.breakdown.taxes.rate.metadata hash
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
total_details.breakdown.taxes.rate.percentage decimal
This represents the tax rate percent out of 100.
total_details.breakdown.taxes.rate.state string
ISO 3166-2 subdivision code, without country prefix. For example, “NY” for New York, United States.
total_details.breakdown.taxes.rate.tax_type string
The high-level tax type, such as
vat
orsales_tax
.
url string
The URL to the Checkout Session.
Create a Session
POST /v1/checkout/sessions
curl https://api.payske.com/v1/checkout/sessions \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d success_url="https://example.com/success" \
-d cancel_url="https://example.com/cancel" \
-d "line_items[0][price]"=price_H5ggYwtDq4fbrJ \
-d "line_items[0][quantity]"=2 \
-d mode=payment
$payske = new \Payske\PayskeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$payske->checkout->sessions->create([
'success_url' => 'https://example.com/success',
'cancel_url' => 'https://example.com/cancel',
'line_items' => [
[
'price' => 'price_H5ggYwtDq4fbrJ',
'quantity' => 2,
],
],
'mode' => 'payment',
]);
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Checkout::Session.create({
success_url: 'https://example.com/success',
cancel_url: 'https://example.com/cancel',
line_items: [
{price: 'price_H5ggYwtDq4fbrJ', quantity: 2},
],
mode: 'payment',
})
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.checkout.Session.create(
success_url="https://example.com/success",
cancel_url="https://example.com/cancel",
line_items=[
{
"price": "price_H5ggYwtDq4fbrJ",
"quantity": 2,
},
],
mode="payment",
)
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
List<Object> lineItems = new ArrayList<>();
Map<String, Object> lineItem1 = new HashMap<>();
lineItem1.put("price", "price_H5ggYwtDq4fbrJ");
lineItem1.put("quantity", 2);
lineItems.add(line_item1);
Map<String, Object> params = new HashMap<>();
params.put(
"success_url",
"https://example.com/success"
);
params.put(
"cancel_url",
"https://example.com/cancel"
);
params.put("line_items", lineItems);
params.put("mode", "payment");
Session session = Session.create(params);
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const session = await payske.checkout.sessions.create({
success_url: 'https://example.com/success',
cancel_url: 'https://example.com/cancel',
line_items: [
{price: 'price_H5ggYwtDq4fbrJ', quantity: 2},
],
mode: 'payment',
});
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.CheckoutSessionParams{
SuccessURL: payske.String("https://example.com/success"),
CancelURL: payske.String("https://example.com/cancel"),
LineItems: []*payske.CheckoutSessionLineItemParams{
&payske.CheckoutSessionLineItemParams{
Price: payske.String("price_H5ggYwtDq4fbrJ"),
Quantity: payske.Int64(2),
},
},
Mode: payske.String(string(payske.CheckoutSessionModePayment)),
}
s, _ := session.New(params)
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new SessionCreateOptions
{
SuccessUrl = "https://example.com/success",
CancelUrl = "https://example.com/cancel",
LineItems = new List<SessionLineItemOptions>
{
new SessionLineItemOptions
{
Price = "price_H5ggYwtDq4fbrJ",
Quantity = 2,
},
},
Mode = "payment",
};
var service = new SessionService();
service.Create(options);
Response
{
"id": "cs_test_9JAHiKx2kgFg2Snc5Gnop1iNIgawrLGBlo3XBXfWfEicPzx9oXBcytyz",
"object": "checkout.session",
"after_expiration": null,
"allow_promotion_codes": null,
"amount_subtotal": null,
"amount_total": null,
"automatic_tax": {
"enabled": false,
"status": null
},
"billing_address_collection": null,
"cancel_url": "https://example.com/cancel",
"client_reference_id": null,
"consent": null,
"consent_collection": null,
"currency": null,
"customer": null,
"customer_details": null,
"customer_email": null,
"expires_at": 1637227692,
"livemode": false,
"locale": null,
"metadata": {},
"mode": "payment",
"payment_intent": "pi_1DpdOt2eZvKYlo2CFOGrwsj4",
"payment_method_options": {},
"payment_method_types": [
"card"
],
"payment_status": "unpaid",
"phone_number_collection": {
"enabled": false
},
"recovered_from": null,
"setup_intent": null,
"shipping": null,
"shipping_address_collection": null,
"shipping_options": [],
"shipping_rate": null,
"status": "expired",
"submit_type": null,
"subscription": null,
"success_url": "https://example.com/success",
"total_details": null,
"url": "https://checkout.payske.com/pay/..."
}
Creates a Session object.
Parameters
cancel_url required
The URL the customer will be directed to if they decide to cancel payment and return to your website.
mode required conditionally
The mode of the Checkout Session. Required when using prices or
setup
mode. Passsubscription
if the Checkout Session includes at least one recurring item.Possible enum values
payment
Accept one-time payments for cards, iDEAL, and more.
setup
Save payment details to charge your customers later.
subscription
Use Payske Billing to set up fixed-price subscriptions.
success_url required
The URL to which Payske should send customers when payment or setup is complete. If you’d like to use information from the successful Checkout Session on your page, read the guide on customizing your success page.
client_reference_id optional
A unique string to reference the Checkout Session. This can be a customer ID, a cart ID, or similar, and can be used to reconcile the session with your internal systems.
customer optional
ID of an existing Customer, if one exists. In
payment
mode, the customer’s most recent card payment method will be used to prefill the email, name, card details, and billing address on the Checkout page. Insubscription
mode, the customer’s default payment method will be used if it’s a card, and otherwise the most recent card will be used. A valid billing address is required for Checkout to prefill the customer’s card details.If the Customer already has a valid email set, the email will be prefilled and not editable in Checkout. If the Customer does not have a valid
email
, Checkout will set the email entered during the session on the Customer.If blank for Checkout Sessions in
payment
orsubscription
mode, Checkout will create a new Customer object based on information provided during the payment flow.You can set
payment_intent_data.setup_future_usage
to have Checkout automatically attach the payment method to the Customer you pass in for future reuse.customer_email optional
If provided, this value will be used when the Customer object is created. If not provided, customers will be asked to enter their email address. Use this parameter to prefill customer data if you already have an email on file. To access information about the customer once a session is complete, use the
customer
field.line_items optional array of hashes
A list of items the customer is purchasing. Use this parameter to pass one-time or recurring Prices.
For
payment
mode, there is a maximum of 100 line items, however it is recommended to consolidate line items if there are more than a few dozen.For
subscription
mode, there is a maximum of 20 line items with recurring Prices and 20 line items with one-time Prices. Line items with one-time Prices in will be on the initial invoice only.Show child parameters
metadata optional dictionary
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to
metadata
.payment_method_types optional enum
A list of the types of payment methods (e.g.,
card
) this Checkout Session can accept.Read more about the supported payment methods and their requirements in our payment method details guide.
If multiple payment methods are passed, Checkout will dynamically reorder them to prioritize the most relevant payment methods based on the customer’s location and other characteristics.
Possible enum values
card
acss_debit
afterpay_clearpay
alipay
bacs_debit
bancontact
boleto
eps
fpx
giropay
grabpay
ideal
klarna
oxxo
p24
sepa_debit
sofort
wechat_pay
More parametersCollapse all
after_expiration optional dictionary
Configure actions after a Checkout Session has expired.
Hide child parameters
after_expiration.recovery optional dictionary
Configure a Checkout Session that can be used to recover an expired session.
Hide child parameters
after_expiration.recovery.enabled required
If
true
, a recovery URL will be generated to recover this Checkout Session if it expires before a successful transaction is completed. It will be attached to the Checkout Session object upon expiration.after_expiration.recovery.allow_promotion_codes optional
Enables user redeemable promotion codes on the recovered Checkout Sessions. Defaults to
false
allow_promotion_codes optional
Enables user redeemable promotion codes.
automatic_tax optional dictionary
Settings for automatic tax lookup for this session and resulting payments, invoices, and subscriptions.
Hide child parameters
billing_address_collection optional enum
Specify whether Checkout should collect the customer’s billing address.
Possible enum values
auto
DefaultCheckout will only collect the billing address when necessary.
required
Checkout will always collect the customer’s billing address.
consent_collection optional dictionary
Configure fields for the Checkout Session to gather active consent from customers.
Hide child parameters
consent_collection.promotions optional enum
If set to
auto
, enables the collection of customer consent for promotional communications. The Checkout Session will determine whether to display an option to opt into promotional communication from the merchant depending on the customer’s locale. Only available to US merchants.Possible enum values
auto
Enable the collection of customer consent for promotional communications. The Checkout Session will determine whether to display an option to opt into promotional communication from the merchant depending on if a customer is provided, and if that customer has consented to receiving promotional communications from the merchant in the past.
customer_update optional dictionary
Controls what fields on Customer can be updated by the Checkout Session. Can only be provided when
customer
is provided.Hide child parameters
customer_update.address optional enum
Describes whether Checkout saves the billing address onto
customer.address
. To always collect a full billing address, usebilling_address_collection
. Defaults tonever
.Possible enum values
auto
never
customer_update.name optional enum
Describes whether Checkout saves the name onto
customer.name
. Defaults tonever
.Possible enum values
auto
never
customer_update.shipping optional enum
Describes whether Checkout saves shipping information onto
customer.shipping
. To collect shipping information, useshipping_address_collection
. Defaults tonever
.Possible enum values
auto
never
discounts optional array of hashes
The coupon or promotion code to apply to this Session. Currently, only up to one may be specified.
Hide child parameters
expires_at optional
The Epoch time in seconds at which the Checkout Session will expire. It can be anywhere from 1 to 24 hours after Checkout Session creation. By default, this value is 24 hours from creation.
locale optional enum
The IETF language tag of the locale Checkout is displayed in. If blank or
auto
, the browser’s locale is used.Possible enum values
auto
bg
cs
da
de
el
en
en-GB
es
es-419
et
fi
fil
fr
fr-CA
hr
hu
id
it
ja
ko
lt
lv
ms
mt
nb
nl
pl
pt
pt-BR
ro
ru
sk
sl
sv
th
tr
vi
zh
zh-HK
zh-TW
payment_intent_data optional dictionary
A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions in
payment
mode.Hide child parameters
payment_intent_data.capture_method optional enum
Controls when the funds will be captured from the customer’s account.
Possible enum values
automatic
(Default) Payske automatically captures funds when the customer authorizes the payment.
manual
Place a hold on the funds when the customer authorizes the payment, but don’t capture the funds until later. (Not all payment methods support this.)
payment_intent_data.description optional
An arbitrary string attached to the object. Often useful for displaying to users.
payment_intent_data.metadata optional dictionary
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to
metadata
.
payment_intent_data.receipt_email optional
Email address that the receipt for the resulting payment will be sent to. If
receipt_email
is specified for a payment in live mode, a receipt will be sent regardless of your email settings.payment_intent_data.setup_future_usage optional enum
Indicates that you intend to make future payments with the payment method collected by this Checkout Session.
When setting this to
on_session
, Checkout will show a notice to the customer that their payment details will be saved.When setting this to
off_session
, Checkout will show a notice to the customer that their payment details will be saved and used for future payments.For both values, Checkout will attach the payment method to either the provided Customer for the session, or a new Customer created by Checkout if one has not been provided.
When processing card payments, Checkout also uses
setup_future_usage
to dynamically optimize your payment flow and comply with regional legislation and network rules, such as SCA.Possible enum values
on_session
Use
on_session
if you intend to only reuse the payment method when your customer is present in your checkout flow.off_session
Use
off_session
if your customer may or may not be present in your checkout flow.
payment_intent_data.shipping optional dictionary
Shipping information for this payment.
Hide child parameters
payment_intent_data.shipping.address required
Shipping address.
Hide child parameters
payment_intent_data.shipping.address.line1 required
Address line 1 (e.g., street, PO Box, or company name).
payment_intent_data.shipping.address.city optional
City, district, suburb, town, or village.
payment_intent_data.shipping.address.country optional
Two-letter country code (ISO 3166-1 alpha-2).
payment_intent_data.shipping.address.line2 optional
Address line 2 (e.g., apartment, suite, unit, or building).
payment_intent_data.shipping.address.postal_code optional
ZIP or postal code.
payment_intent_data.shipping.address.state optional
State, county, province, or region.
payment_intent_data.shipping.name required
Recipient name.
payment_intent_data.shipping.carrier optional
The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc.
payment_intent_data.shipping.phone optional
Recipient phone (including extension).
payment_intent_data.shipping.tracking_number optional
The tracking number for a physical product, obtained from the delivery service. If multiple tracking numbers were generated for this purchase, please separate them with commas.
payment_intent_data.statement_descriptor optional
Extra information about the payment. This will appear on your customer’s statement when this payment succeeds in creating a charge.
payment_intent_data.statement_descriptor_suffix optional
Provides information about the charge that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that’s set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor.
payment_method_options optional dictionary
Payment-method-specific configuration.
Hide child parameters
payment_method_options.acss_debit optional dictionary
contains details about the ACSS Debit payment method options.
Hide child parameters
payment_method_options.acss_debit.currency optional enum
Three-letter ISO currency code, in lowercase. Must be a supported currency. This is only accepted for Checkout Sessions in
setup
mode.Possible enum values
cad
Canadian dollars
usd
US dollars
payment_method_options.acss_debit.mandate_options optional dictionary
Additional fields for Mandate creation
Hide child parameters
payment_method_options.acss_debit.mandate_options.custom_mandate_url optional
A URL for custom mandate text to render during confirmation step. The URL will be rendered with additional GET parameters
payment_intent
andpayment_intent_client_secret
when confirming a Payment Intent, orsetup_intent
andsetup_intent_client_secret
when confirming a Setup Intent.payment_method_options.acss_debit.mandate_options.default_for optional enum
List of Payske products where this mandate can be selected automatically. Only usable in
setup
mode.Possible enum values
invoice
Enables payments for Payske Invoices. ‘subscription’ must also be provided.
subscription
Enables payments for Payske Subscriptions. ‘invoice’ must also be provided.
payment_method_options.acss_debit.mandate_options.interval_description optional
Description of the mandate interval. Only required if ‘payment_schedule’ parameter is ‘interval’ or ‘combined’.
payment_method_options.acss_debit.mandate_options.payment_schedule optional enum
Payment schedule for the mandate.
Possible enum values
interval
Payments are initiated at a regular pre-defined interval
sporadic
Payments are initiated sporadically
combined
Payments can be initiated at a pre-defined interval or sporadically
payment_method_options.acss_debit.mandate_options.transaction_type optional enum
Transaction type of the mandate.
Possible enum values
personal
Transactions are made for personal reasons
business
Transactions are made for business reasons
payment_method_options.acss_debit.verification_method optional enum
Verification method for the intent
Possible enum values
automatic
Instant verification with fallback to microdeposits.
instant
Instant verification.
microdeposits
Verification using microdeposits.
payment_method_options.boleto optional dictionary
contains details about the Boleto payment method options.
Show child parameters
payment_method_options.oxxo optional dictionary
contains details about the OXXO payment method options.
Show child parameters
payment_method_options.wechat_pay optional dictionary
contains details about the Wechat Pay payment method options.
Show child parameters
phone_number_collection optional dictionary
Controls phone number collection settings for the session.
We recommend that you review your privacy policy and check with your legal contacts before using this feature. Learn more about collecting phone numbers with Checkout.
Hide child parameters
setup_intent_data optional dictionary
A subset of parameters to be passed to SetupIntent creation for Checkout Sessions in
setup
mode.Hide child parameters
setup_intent_data.description optional
An arbitrary string attached to the object. Often useful for displaying to users.
setup_intent_data.metadata optional dictionary
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to
metadata
.setup_intent_data.on_behalf_of optional
Connect only
The Payske account for which the setup is intended.
shipping_address_collection optional dictionary
When set, provides configuration for Checkout to collect a shipping address from a customer.
Hide child parameters
shipping_address_collection.allowed_countries required
An array of two-letter ISO country codes representing which countries Checkout should provide as options for shipping locations. Unsupported country codes:
AS, CX, CC, CU, HM, IR, KP, MH, FM, NF, MP, PW, SD, SY, UM, VI
.Possible enum values
AC
AD
AE
AF
AG
AI
AL
AM
AO
AQ
AR
AT
AU
AW
AX
AZ
BA
BB
BD
BE
BF
BG
BH
BI
BJ
BL
BM
BN
BO
BQ
BR
BS
BT
BV
BW
BY
BZ
CA
CD
CF
CG
CH
CI
CK
CL
CM
CN
CO
CR
CV
CW
CY
CZ
DE
DJ
DK
DM
DO
DZ
EC
EE
EG
EH
ER
ES
ET
FI
FJ
FK
FO
FR
GA
GB
GD
GE
GF
GG
GH
GI
GL
GM
GN
GP
GQ
GR
GS
GT
GU
GW
GY
HK
HN
HR
HT
HU
ID
IE
IL
IM
IN
IO
IQ
IS
IT
JE
JM
JO
JP
KE
KG
KH
KI
KM
KN
KR
KW
KY
KZ
LA
LB
LC
LI
LK
LR
LS
LT
LU
LV
LY
MA
MC
MD
ME
MF
MG
MK
ML
MM
MN
MO
MQ
MR
MS
MT
MU
MV
MW
MX
MY
MZ
NA
NC
NE
NG
NI
NL
NO
NP
NR
NU
NZ
OM
PA
PE
PF
PG
PH
PK
PL
PM
PN
PR
PS
PT
PY
QA
RE
RO
RS
RU
RW
SA
SB
SC
SE
SG
SH
SI
SJ
SK
SL
SM
SN
SO
SR
SS
ST
SV
SX
SZ
TA
TC
TD
TF
TG
TH
TJ
TK
TL
TM
TN
TO
TR
TT
TV
TW
TZ
UA
UG
US
UY
UZ
VA
VC
VE
VG
VN
VU
WF
WS
XK
YE
YT
ZA
ZM
ZW
ZZ
shipping_options optional array of hashes
The shipping rate options to apply to this Session.
Hide child parameters
shipping_options.shipping_rate required unless shipping_rate_data is provided
The ID of the Shipping Rate to use for this shipping option.
shipping_options.shipping_rate_data required unless shipping_rate is provided
Parameters to be passed to Shipping Rate creation for this shipping option
Hide child parameters
shipping_options.shipping_rate_data.display_name required
The name of the shipping rate, meant to be displayable to the customer. This will appear on CheckoutSessions.
shipping_options.shipping_rate_data.type required
The type of calculation to use on the shipping rate. Can only be
fixed_amount
for now.Possible enum values
fixed_amount
shipping_options.shipping_rate_data.delivery_estimate optional dictionary
The estimated range for how long shipping will take, meant to be displayable to the customer. This will appear on CheckoutSessions.
Hide child parameters
shipping_options.shipping_rate_data.delivery_estimate.maximum optional dictionary
The upper bound of the estimated range. If empty, represents no upper bound i.e., infinite.
Hide child parameters
shipping_options.shipping_rate_data.delivery_estimate.minimum optional dictionary
The lower bound of the estimated range. If empty, represents no lower bound.
Hide child parameters
shipping_options.shipping_rate_data.fixed_amount optional dictionary
Describes a fixed amount to charge for shipping. Must be present if type is
fixed_amount
.Hide child parameters
shipping_options.shipping_rate_data.fixed_amount.amount required
A non-negative integer in cents representing how much to charge.
shipping_options.shipping_rate_data.fixed_amount.currency required
Three-letter ISO currency code, in lowercase. Must be a supported currency.
shipping_options.shipping_rate_data.metadata optional dictionary
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to
metadata
.shipping_options.shipping_rate_data.tax_behavior optional
Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of
inclusive
,exclusive
, orunspecified
.shipping_options.shipping_rate_data.tax_code optional
A tax code ID. The Shipping tax code is
txcd_92010001
.
submit_type optional enum
Describes the type of transaction being performed by Checkout in order to customize relevant text on the page, such as the submit button.
submit_type
can only be specified on Checkout Sessions inpayment
mode, but not Checkout Sessions insubscription
orsetup
mode.Possible enum values
auto
pay
book
donate
subscription_data optional dictionary
A subset of parameters to be passed to subscription creation for Checkout Sessions in
subscription
mode.Hide child parameters
subscription_data.default_tax_rates optional
The tax rates that will apply to any subscription item that does not have
tax_rates
set. Invoices created will have theirdefault_tax_rates
populated from the subscription.subscription_data.items optional array of hashes deprecated
A list of items, each with an attached plan, that the customer is subscribing to. Prefer using
line_items
.Hide child parameters
subscription_data.items.plan required
Plan ID for this item.
subscription_data.items.quantity optional
The quantity of the subscription item being purchased. Quantity should not be defined when
recurring.usage_type=metered
.subscription_data.items.tax_rates optional
The tax rates which apply to this item. When set, the
default_tax_rates
onsubscription_data
do not apply to this item.
subscription_data.metadata optional dictionary
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to
metadata
.
* ### [](#create_checkout_session-subscription_data-trial_end)subscription_data.trial_end optional
Unix timestamp representing the end of the trial period the customer will get before being charged for the first time. Has to be at least 48 hours in the future.
* ### [](#create_checkout_session-subscription_data-trial_period_days)subscription_data.trial_period_days optional
Integer representing the number of trial period days before the customer is charged for the first time. Has to be at least 1.
tax_id_collection optional dictionary
Controls tax ID collection settings for the session.
Hide child parameters
Returns
Returns a Session object.
Retrieve a Session
GET /v1/checkout/sessions/:id
curl https://api.payske.com/v1/checkout/sessions/cs_test_9JAHiKx2kgFg2Snc5Gnop1iNIgawrLGBlo3XBXfWfEicPzx9oXBcytyz \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc:
$payske = new \Payske\PayskeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$payske->checkout->sessions->retrieve(
'cs_test_HtdVzy0CBBG68eeDutxDrA8FoU25FtztpVXKvzOkP5fCngfIaz2bYzVN',
[]
);
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Checkout::Session.retrieve(
'cs_test_KxdpuZ9PZJSS1KZjY89L0oxsCA1gf8COrUZXpLnul35pSVjsCFAQQZdf',
)
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.checkout.Session.retrieve(
"cs_test_NXhuXNGmYxwLMHvMYNxceHm5Awd23bcqQkT0rwm5O4w6GgD3MiH6Er6W",
)
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Session session =
Session.retrieve(
"cs_test_L60TbUHmymAA4ob0L8k7YcHWDmccKbxIjik7DVUit1CRSw5msT6fKgju"
);
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const session = await payske.checkout.sessions.retrieve(
'cs_test_gg0MZ8zY1fhRdYxMdEheLX0IMMnPQ54PKuhxpovGj4V6mKmWFaPOas6g'
);
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
s, _ := session.Get(
"cs_test_Z1DSZumlvoAbBgAuRXGNQ3Yk3RQ4E81FRYKG5itV4XIIoXn3wk97p9Y7",
nil,
)
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var service = new SessionService();
service.Get(
"cs_test_TOI0autYW2TkIaPQZsXnEB2Qj2iijA6qWL3NqGLcU1PDvmkYQvNc9r8Z"
);
Response
{
"id": "cs_test_9JAHiKx2kgFg2Snc5Gnop1iNIgawrLGBlo3XBXfWfEicPzx9oXBcytyz",
"object": "checkout.session",
"after_expiration": null,
"allow_promotion_codes": null,
"amount_subtotal": null,
"amount_total": null,
"automatic_tax": {
"enabled": false,
"status": null
},
"billing_address_collection": null,
"cancel_url": "https://example.com/cancel",
"client_reference_id": null,
"consent": null,
"consent_collection": null,
"currency": null,
"customer": null,
"customer_details": null,
"customer_email": null,
"expires_at": 1637227692,
"livemode": false,
"locale": null,
"metadata": {},
"mode": "payment",
"payment_intent": "pi_1DpdOt2eZvKYlo2CFOGrwsj4",
"payment_method_options": {},
"payment_method_types": [
"card"
],
"payment_status": "unpaid",
"phone_number_collection": {
"enabled": false
},
"recovered_from": null,
"setup_intent": null,
"shipping": null,
"shipping_address_collection": null,
"shipping_options": [],
"shipping_rate": null,
"status": "expired",
"submit_type": null,
"subscription": null,
"success_url": "https://example.com/success",
"total_details": null,
"url": null
}
Retrieves a Session object.
Parameters
No parameters.
Returns
Returns a Session object.
List all Checkout Sessions
GET /v1/checkout/sessions
curl https://api.payske.com/v1/checkout/sessions \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d limit=3 \
-G
$payske = new \Payske\PayskeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$payske->checkout->sessions->all(['limit' => 3]);
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Checkout::Session.list({limit: 3})
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.checkout.Session.list(limit=3)
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Map<String, Object> params = new HashMap<>();
params.put("limit", 3);
SessionCollection sessions = Session.list(params);
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const sessions = await payske.checkout.sessions.list({
limit: 3,
});
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.CheckoutSessionListParams{}
params.Filters.AddFilter("limit", "", "3")
i := session.List(params)
for i.Next() {
s := i.CheckoutSession()
}
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new SessionListOptions
{
Limit = 3,
};
var service = new SessionService();
PayskeList<Session> sessions = service.List(
options
);
Response
{
"object": "list",
"url": "/v1/checkout/sessions",
"has_more": false,
"data": [
{
"id": "cs_test_9JAHiKx2kgFg2Snc5Gnop1iNIgawrLGBlo3XBXfWfEicPzx9oXBcytyz",
"object": "checkout.session",
"after_expiration": null,
"allow_promotion_codes": null,
"amount_subtotal": null,
"amount_total": null,
"automatic_tax": {
"enabled": false,
"status": null
},
"billing_address_collection": null,
"cancel_url": "https://example.com/cancel",
"client_reference_id": null,
"consent": null,
"consent_collection": null,
"currency": null,
"customer": null,
"customer_details": null,
"customer_email": null,
"expires_at": 1637227692,
"livemode": false,
"locale": null,
"metadata": {},
"mode": "payment",
"payment_intent": "pi_1DpdOt2eZvKYlo2CFOGrwsj4",
"payment_method_options": {},
"payment_method_types": [
"card"
],
"payment_status": "unpaid",
"phone_number_collection": {
"enabled": false
},
"recovered_from": null,
"setup_intent": null,
"shipping": null,
"shipping_address_collection": null,
"shipping_options": [],
"shipping_rate": null,
"status": "expired",
"submit_type": null,
"subscription": null,
"success_url": "https://example.com/success",
"total_details": null,
"url": null
},
{...},
{...}
]
}
Returns a list of Checkout Sessions.
Parameters
payment_intent optional
Only return the Checkout Session for the PaymentIntent specified.
subscription optional
Only return the Checkout Session for the subscription specified.
More parametersCollapse all
ending_before optional
A cursor for use in pagination.
ending_before
is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting withobj_bar
, your subsequent call can includeending_before=obj_bar
in order to fetch the previous page of the list.limit optional
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
starting_after optional
A cursor for use in pagination.
starting_after
is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending withobj_foo
, your subsequent call can includestarting_after=obj_foo
in order to fetch the next page of the list.
Returns
A dictionary with a data
property that contains an array of up to limit
Checkout Sessions, starting after Checkout Session starting_after
. Each entry in the array is a separate Checkout Session object. If no more Checkout Sessions are available, the resulting array will be empty.
Retrieve a Session's line items
Retrieve a Checkout Session's line items
GET /v1/checkout/sessions/:id/line_items
curl https://api.payske.com/v1/checkout/sessions/cs_test_9JAHiKx2kgFg2Snc5Gnop1iNIgawrLGBlo3XBXfWfEicPzx9oXBcytyz/line_items?limit=5 \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc:
$payske = new \Payske\PayskeClient("sk_test_4eC39HqLyjWDarjtT1zdp7dc");
$line_items = $payske->checkout->sessions->allLineItems('cs_test_HtdVzy0CBBG68eeDutxDrA8FoU25FtztpVXKvzOkP5fCngfIaz2bYzVN', ['limit' => 5]);
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
line_items = Payske::Checkout::Session.list_line_items('cs_test_bQgFMROfjn5l0Jc2wSm9V5HQ1odVn7YkOGgRfdTHt4JoUKOAlinq9vws', {limit: 5})
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
line_items = payske.checkout.Session.list_line_items('cs_test_NXhuXNGmYxwLMHvMYNxceHm5Awd23bcqQkT0rwm5O4w6GgD3MiH6Er6W', limit=5)
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Session session = Session.retrieve("cs_test_L60TbUHmymAA4ob0L8k7YcHWDmccKbxIjik7DVUit1CRSw5msT6fKgju");
Map<String, Object> params = new HashMap<>();
params.put("limit", 5);
LineItemCollection lineItems = session.listLineItems(params);
const Payske = require('payske');
const payske = Payske('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
payske.checkout.sessions.listLineItems(
'cs_test_gg0MZ8zY1fhRdYxMdEheLX0IMMnPQ54PKuhxpovGj4V6mKmWFaPOas6g',
{ limit: 5 },
function(err, lineItems) {
// asynchronously called
}
);
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.CheckoutSessionListLineItemParams{
ID: payske.String("cs_test_Z1DSZumlvoAbBgAuRXGNQ3Yk3RQ4E81FRYKG5itV4XIIoXn3wk97p9Y7"),
}
params.Filters.AddFilter("limit", "", "5")
i := session.ListLineItems(params)
for i.Next() {
li := i.LineItem()
}
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new SessionListLineItemsOptions
{
Limit = 5,
};
var service = new SessionService();
PayskeList<LineItem> = service.ListLineItems("cs_test_TOI0autYW2TkIaPQZsXnEB2Qj2iijA6qWL3NqGLcU1PDvmkYQvNc9r8Z", options);
Response
{
"object": "list",
"url": "/v1/checkout/sessions/cs_test_9JAHiKx2kgFg2Snc5Gnop1iNIgawrLGBlo3XBXfWfEicPzx9oXBcytyz/line_items",
"has_more": false,
"data": [
{
"id": "li_1Jx6ue2eZvKYlo2CPmEdYb2N",
"object": "item",
"amount_subtotal": 0,
"amount_total": 0,
"currency": "usd",
"description": "Tin of Cookies",
"price": {
"id": "price_1Jx64D2eZvKYlo2C5cws8LZD",
"object": "price",
"active": true,
"billing_scheme": "per_unit",
"created": 1637224441,
"currency": "usd",
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"product": "prod_KcKjmOkvbeSdpk",
"recurring": null,
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
"unit_amount": 299,
"unit_amount_decimal": "299"
},
"quantity": 1
},
{...},
{...}
]
}
When retrieving a Checkout Session, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
Parameters
ending_before optional
A cursor for use in pagination.
ending_before
is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting withobj_bar
, your subsequent call can includeending_before=obj_bar
in order to fetch the previous page of the list.limit optional
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
starting_after optional
A cursor for use in pagination.
starting_after
is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending withobj_foo
, your subsequent call can includestarting_after=obj_foo
in order to fetch the next page of the list.
Returns
A dictionary with a data
property that contains an array of up to limit
Checkout Session line items, starting after Line Item starting_after
. Each entry in the array is a separate Line Item object. If no more line items are available, the resulting array will be empty.
Events
- Endpoints:
Events are our way of letting you know when something interesting happens in your account. When an interesting event occurs, we create a new Event
object. For example, when a charge succeeds, we create a charge.succeeded
event; and when an invoice payment attempt fails, we create an invoice.payment_failed
event. Note that many API requests may cause multiple events to be created. For example, if you create a new subscription for a customer, you will receive both a customer.subscription.created
event and a charge.succeeded
event.
Events occur when the state of another API resource changes. The state of that resource at the time of the change is embedded in the event's data field. For example, a charge.succeeded
event will contain a charge, and an invoice.payment_failed
event will contain an invoice.
As with other API resources, you can use endpoints to retrieve an individual event or a list of events from the API. We also have a separate webhooks system for sending the Event
objects directly to an endpoint on your server. Webhooks are managed in your account settings, and our Using Webhooks guide will help you get set up.
When using Connect, you can also receive notifications of events that occur in connected accounts. For these events, there will be an additional account
attribute in the received Event
object.
NOTE: Right now, access to events through the Retrieve Event API is guaranteed only for 30 days.
Was this section helpful? Yes No
The event object
The event object
{
"id": "evt_1CiPtv2eZvKYlo2CcUZsDcO6",
"object": "event",
"api_version": "2018-05-21",
"created": 1530291411,
"data": {
"object": {
"id": "src_1CiPsl2eZvKYlo2CVVyt3LKy",
"object": "source",
"amount": 1000,
"client_secret": "src_client_secret_D8hHhtdrGWQyK8bLM4M3uFQ6",
"created": 1530291339,
"currency": "eur",
"flow": "redirect",
"livemode": false,
"metadata": {},
"owner": {
"address": null,
"email": null,
"name": null,
"phone": null,
"verified_address": null,
"verified_email": null,
"verified_name": "Jenny Rosen",
"verified_phone": null
},
"redirect": {
"failure_reason": null,
"return_url": "https://minkpolice.com",
"status": "succeeded",
"url": "https://hooks.payske.com/redirect/authenticate/src_1CiPsl2eZvKYlo2CVVyt3LKy?client_secret=src_client_secret_D8hHhtdrGWQyK8bLM4M3uFQ6"
},
"sofort": {
"country": "DE",
"bank_code": "DEUT",
"bank_name": "Deutsche Bank",
"bic": "DEUTDE2H",
"iban_last4": "3000",
"statement_descriptor": null,
"preferred_language": null
},
"statement_descriptor": null,
"status": "chargeable",
"type": "sofort",
"usage": "single_use"
}
},
"livemode": false,
"pending_webhooks": 0,
"request": {
"id": null,
"idempotency_key": null
},
"type": "source.chargeable"
}
Attributes
id string
Unique identifier for the object.
api_version string
The Payske API version used to render
data
. Note: This property is populated only for events on or after October 31, 2014.data hash
Object containing data associated with the event.
Hide child attributes
data.object hash
Object containing the API resource relevant to the event. For example, an
invoice.created
event will have a full invoice object as the value of the object key.data.previous_attributes hash
Object containing the names of the attributes that have changed, and their previous values (sent along only with *.updated events).
request hash
Information on the API request that instigated the event.
Hide child attributes
request.id string
ID of the API request that caused the event. If null, the event was automatic (e.g., Payske’s automatic subscription handling). Request logs are available in the dashboard, but currently not in the API.
request.idempotency_key string
The idempotency key transmitted during the request, if any. Note: This property is populated only for events on or after May 23, 2017.
type string
Description of the event (e.g.,
invoice.created
orcharge.refunded
).
More attributesCollapse all
object string, value is "event"
String representing the object’s type. Objects of the same type share the same value.
created timestamp
Time at which the object was created. Measured in seconds since the Unix epoch.
livemode boolean
Has the value
true
if the object exists in live mode or the valuefalse
if the object exists in test mode.pending_webhooks positive integer or zero
Number of webhooks that have yet to be successfully delivered (i.e., to return a 20x response) to the URLs you’ve specified.
Retrieve an event
GET /v1/events/:id
curl https://api.payske.com/v1/events/evt_1CiPtv2eZvKYlo2CcUZsDcO6 \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc:
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Event.retrieve(
'evt_1CiPtv2eZvKYlo2CcUZsDcO6',
)
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Event.retrieve(
"evt_1CiPtv2eZvKYlo2CcUZsDcO6",
)
$payske = new \Payske\PayskeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$payske->events->retrieve(
'evt_1CiPtv2eZvKYlo2CcUZsDcO6',
[]
);
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Event event =
Event.retrieve("evt_1CiPtv2eZvKYlo2CcUZsDcO6");
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const event = await payske.events.retrieve(
'evt_1CiPtv2eZvKYlo2CcUZsDcO6'
);
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
e, _ := event.Get(
"evt_1CiPtv2eZvKYlo2CcUZsDcO6",
nil,
)
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var service = new EventService();
service.Get("evt_1CiPtv2eZvKYlo2CcUZsDcO6");
Response
{
"id": "evt_1CiPtv2eZvKYlo2CcUZsDcO6",
"object": "event",
"api_version": "2018-05-21",
"created": 1530291411,
"data": {
"object": {
"id": "src_1CiPsl2eZvKYlo2CVVyt3LKy",
"object": "source",
"amount": 1000,
"client_secret": "src_client_secret_D8hHhtdrGWQyK8bLM4M3uFQ6",
"created": 1530291339,
"currency": "eur",
"flow": "redirect",
"livemode": false,
"metadata": {},
"owner": {
"address": null,
"email": null,
"name": null,
"phone": null,
"verified_address": null,
"verified_email": null,
"verified_name": "Jenny Rosen",
"verified_phone": null
},
"redirect": {
"failure_reason": null,
"return_url": "https://minkpolice.com",
"status": "succeeded",
"url": "https://hooks.payske.com/redirect/authenticate/src_1CiPsl2eZvKYlo2CVVyt3LKy?client_secret=src_client_secret_D8hHhtdrGWQyK8bLM4M3uFQ6"
},
"sofort": {
"country": "DE",
"bank_code": "DEUT",
"bank_name": "Deutsche Bank",
"bic": "DEUTDE2H",
"iban_last4": "3000",
"statement_descriptor": null,
"preferred_language": null
},
"statement_descriptor": null,
"status": "chargeable",
"type": "sofort",
"usage": "single_use"
}
},
"livemode": false,
"pending_webhooks": 0,
"request": {
"id": null,
"idempotency_key": null
},
"type": "source.chargeable"
}
Retrieves the details of an event. Supply the unique identifier of the event, which you might have received in a webhook.
Parameters
No parameters.
Returns
Returns an event object if a valid identifier was provided. All events share a common structure, detailed to the right. The only property that will differ is the data
property.
In each case, the data
dictionary will have an attribute called object
and its value will be the same as retrieving the same object directly from the API. For example, a customer.created
event will have the same information as retrieving the relevant customer would.
In cases where the attributes of an object have changed, data
will also contain a dictionary containing the changes.
List all events
GET /v1/events
curl https://api.payske.com/v1/events \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d limit=3 \
-G
require 'payske'
Payske.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
Payske::Event.list({limit: 3})
import payske
payske.api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
payske.Event.list(limit=3)
$payske = new \Payske\PayskeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$payske->events->all(['limit' => 3]);
Payske.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Map<String, Object> params = new HashMap<>();
params.put("limit", 3);
EventCollection events = Event.list(params);
const payske = require('payske')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
const events = await payske.events.list({
limit: 3,
});
payske.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
params := &payske.EventListParams{}
params.Filters.AddFilter("limit", "", "3")
i := event.List(params)
for i.Next() {
e := i.Event()
}
PayskeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new EventListOptions { Limit = 3 };
var service = new EventService();
PayskeList<Event> events = service.List(options);
Response
{
"object": "list",
"url": "/v1/events",
"has_more": false,
"data": [
{
"id": "evt_1CiPtv2eZvKYlo2CcUZsDcO6",
"object": "event",
"api_version": "2018-05-21",
"created": 1530291411,
"data": {
"object": {
"id": "src_1CiPsl2eZvKYlo2CVVyt3LKy",
"object": "source",
"amount": 1000,
"client_secret": "src_client_secret_D8hHhtdrGWQyK8bLM4M3uFQ6",
"created": 1530291339,
"currency": "eur",
"flow": "redirect",
"livemode": false,
"metadata": {},
"owner": {
"address": null,
"email": null,
"name": null,
"phone": null,
"verified_address": null,
"verified_email": null,
"verified_name": "Jenny Rosen",
"verified_phone": null
},
"redirect": {
"failure_reason": null,
"return_url": "https://minkpolice.com",
"status": "succeeded",
"url": "https://hooks.payske.com/redirect/authenticate/src_1CiPsl2eZvKYlo2CVVyt3LKy?client_secret=src_client_secret_D8hHhtdrGWQyK8bLM4M3uFQ6"
},
"sofort": {
"country": "DE",
"bank_code": "DEUT",
"bank_name": "Deutsche Bank",
"bic": "DEUTDE2H",
"iban_last4": "3000",
"statement_descriptor": null,
"preferred_language": null
},
"statement_descriptor": null,
"status": "chargeable",
"type": "sofort",
"usage": "single_use"
}
},
"livemode": false,
"pending_webhooks": 0,
"request": {
"id": null,
"idempotency_key": null
},
"type": "source.chargeable"
},
{...},
{...}
]
}
List events, going back up to 30 days. Each event data is rendered according to Payske API version at its creation time, specified in event object api_version
attribute (not according to your current Payske API version or Payske-Version
header).
Parameters
types optional
An array of up to 20 strings containing specific event names. The list will be filtered to include only events with a matching event property. You may pass either
type
ortypes
, but not both.
More parametersCollapse all
created optional dictionary
A filter on the list based on the object
created
field. The value can be a string with an integer Unix timestamp, or it can be a dictionary with the following options:Hide child parameters
created.gt optional
Return results where the
created
field is greater than this value.created.gte optional
Return results where the
created
field is greater than or equal to this value.created.lt optional
Return results where the
created
field is less than this value.created.lte optional
Return results where the
created
field is less than or equal to this value.
delivery_success optional
Filter events by whether all webhooks were successfully delivered. If false, events which are still pending or have failed all delivery attempts to a webhook endpoint will be returned.
ending_before optional
A cursor for use in pagination.
ending_before
is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting withobj_bar
, your subsequent call can includeending_before=obj_bar
in order to fetch the previous page of the list.limit optional
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
starting_after optional
A cursor for use in pagination.
starting_after
is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending withobj_foo
, your subsequent call can includestarting_after=obj_foo
in order to fetch the next page of the list.type optional
A string containing a specific event name, or group of events using * as a wildcard. The list will be filtered to include only events with a matching event property.
Returns
A dictionary with a data
property that contains an array of up to limit
events, starting after event starting_after
. Each entry in the array is a separate event object. If no more events are available, the resulting array will be empty. This request should never return an error.
Types of events
This is a list of all the types of events we currently send. We may add more at any time, so in developing and maintaining your code, you should not assume that only these types exist.
You'll notice that these events follow a pattern: resource.event
. Our goal is to design a consistent system that makes things easier to anticipate and code against. NOTE: Events that occur on subresources like customer.subscription
do not trigger the parent's update
event.
Events marked as selection required are only created when a webhook has been configured to listen for that type of event specifically. A webhook set to listen to all events will not receive an event requiring explicit selection.
Was this section helpful?YesNo
Event
account.updated
data.object
is an accountOccurs whenever an account status or property has changed.
account.application.authorized
data.object
is an "application"Occurs whenever a user authorizes an application. Sent to the related application only.
Hide child attributes
account.application.deauthorized
data.object
is an "application"Occurs whenever a user deauthorizes an application. Sent to the related application only.
Hide child attributes
account.external_account.created
data.object
is an external account (e.g., card or bank account)Occurs whenever an external account is created.
account.external_account.deleted
data.object
is an external account (e.g., card or bank account)Occurs whenever an external account is deleted.
account.external_account.updated
data.object
is an external account (e.g., card or bank account)Occurs whenever an external account is updated.
application_fee.created
data.object
is an application feeOccurs whenever an application fee is created on a charge.
application_fee.refunded
data.object
is an application feeOccurs whenever an application fee is refunded, whether from refunding a charge or from refunding the application fee directly. This includes partial refunds.
application_fee.refund.updated
data.object
is a fee refundOccurs whenever an application fee refund is updated.
balance.available
data.object
is a balanceOccurs whenever your Payske balance has been updated (e.g., when a charge is available to be paid out). By default, Payske automatically transfers funds in your balance to your bank account on a daily basis.
billing_portal.configuration.created
data.object
is a portal configurationOccurs whenever a portal configuration is created.
billing_portal.configuration.updated
data.object
is a portal configurationOccurs whenever a portal configuration is updated.
capability.updated
data.object
is a capabilityOccurs whenever a capability has new requirements or a new status.
charge.captured
data.object
is a chargeOccurs whenever a previously uncaptured charge is captured.
charge.expired
data.object
is a chargeOccurs whenever an uncaptured charge expires.
charge.failed
data.object
is a chargeOccurs whenever a failed charge attempt occurs.
charge.pending
data.object
is a chargeOccurs whenever a pending charge is created.
charge.refunded
data.object
is a chargeOccurs whenever a charge is refunded, including partial refunds.
charge.succeeded
data.object
is a chargeOccurs whenever a new charge is created and is successful.
charge.updated
data.object
is a chargeOccurs whenever a charge description or metadata is updated.
charge.dispute.closed
data.object
is a disputeOccurs when a dispute is closed and the dispute status changes to
lost
,warning_closed
, orwon
.charge.dispute.created
data.object
is a disputeOccurs whenever a customer disputes a charge with their bank.
charge.dispute.funds_reinstated
data.object
is a disputeOccurs when funds are reinstated to your account after a dispute is closed. This includes partially refunded payments.
charge.dispute.funds_withdrawn
data.object
is a disputeOccurs when funds are removed from your account due to a dispute.
charge.dispute.updated
data.object
is a disputeOccurs when the dispute is updated (usually with evidence).
charge.refund.updated
data.object
is a refundOccurs whenever a refund is updated, on selected payment methods.
checkout.session.async_payment_failed
data.object
is a checkout sessionOccurs when a payment intent using a delayed payment method fails.
checkout.session.async_payment_succeeded
data.object
is a checkout sessionOccurs when a payment intent using a delayed payment method finally succeeds.
checkout.session.completed
data.object
is a checkout sessionOccurs when a Checkout Session has been successfully completed.
checkout.session.expired
data.object
is a checkout sessionOccurs when a Checkout Session is expired.
coupon.created
data.object
is a couponOccurs whenever a coupon is created.
coupon.deleted
data.object
is a couponOccurs whenever a coupon is deleted.
coupon.updated
data.object
is a couponOccurs whenever a coupon is updated.
credit_note.created
data.object
is a credit noteOccurs whenever a credit note is created.
credit_note.updated
data.object
is a credit noteOccurs whenever a credit note is updated.
credit_note.voided
data.object
is a credit noteOccurs whenever a credit note is voided.
customer.created
data.object
is a customerOccurs whenever a new customer is created.
customer.deleted
data.object
is a customerOccurs whenever a customer is deleted.
customer.updated
data.object
is a customerOccurs whenever any property of a customer changes.
customer.discount.created
data.object
is a discountOccurs whenever a coupon is attached to a customer.
customer.discount.deleted
data.object
is a discountOccurs whenever a coupon is removed from a customer.
customer.discount.updated
data.object
is a discountOccurs whenever a customer is switched from one coupon to another.
customer.source.created
data.object
is a source (e.g., card)Occurs whenever a new source is created for a customer.
customer.source.deleted
data.object
is a source (e.g., card)Occurs whenever a source is removed from a customer.
customer.source.expiring
data.object
is a source (e.g., card)Occurs whenever a card or source will expire at the end of the month.
customer.source.updated
data.object
is a source (e.g., card)Occurs whenever a source's details are changed.
customer.subscription.created
data.object
is a subscriptionOccurs whenever a customer is signed up for a new plan.
customer.subscription.deleted
data.object
is a subscriptionOccurs whenever a customer's subscription ends.
customer.subscription.pending_update_applied
data.object
is a subscriptionOccurs whenever a customer's subscription's pending update is applied, and the subscription is updated.
customer.subscription.pending_update_expired
data.object
is a subscriptionOccurs whenever a customer's subscription's pending update expires before the related invoice is paid.
customer.subscription.trial_will_end
data.object
is a subscriptionOccurs three days before a subscription's trial period is scheduled to end, or when a trial is ended immediately (using
trial_end=now
).customer.subscription.updated
data.object
is a subscriptionOccurs whenever a subscription changes (e.g., switching from one plan to another, or changing the status from trial to active).
customer.tax_id.created
data.object
is a tax idOccurs whenever a tax ID is created for a customer.
customer.tax_id.deleted
data.object
is a tax idOccurs whenever a tax ID is deleted from a customer.
customer.tax_id.updated
data.object
is a tax idOccurs whenever a customer's tax ID is updated.
file.created
data.object
is a fileOccurs whenever a new Payske-generated file is available for your account.
identity.verification_session.canceled
data.object
is a verification sessionOccurs whenever a VerificationSession is canceled
identity.verification_session.created
data.object
is a verification sessionOccurs whenever a VerificationSession is created
identity.verification_session.processing
data.object
is a verification sessionOccurs whenever a VerificationSession transitions to processing
identity.verification_session.redactedselection required
data.object
is a verification sessionOccurs whenever a VerificationSession is redacted. You must create a webhook endpoint which explicitly subscribes to this event type to access it. Webhook endpoints which subscribe to all events will not include this event type.
identity.verification_session.requires_input
data.object
is a verification sessionOccurs whenever a VerificationSession transitions to require user input
identity.verification_session.verified
data.object
is a verification sessionOccurs whenever a VerificationSession transitions to verified
invoice.created
data.object
is an invoiceOccurs whenever a new invoice is created. To learn how webhooks can be used with this event, and how they can affect it, see Using Webhooks with Subscriptions.
invoice.deleted
data.object
is an invoiceOccurs whenever a draft invoice is deleted.
invoice.finalization_failed
data.object
is an invoiceOccurs whenever a draft invoice cannot be finalized. See the invoice’s last finalization error for details.
invoice.finalized
data.object
is an invoiceOccurs whenever a draft invoice is finalized and updated to be an open invoice.
invoice.marked_uncollectible
data.object
is an invoiceOccurs whenever an invoice is marked uncollectible.
invoice.paid
data.object
is an invoiceOccurs whenever an invoice payment attempt succeeds or an invoice is marked as paid out-of-band.
invoice.payment_action_required
data.object
is an invoiceOccurs whenever an invoice payment attempt requires further user action to complete.
invoice.payment_failed
data.object
is an invoiceOccurs whenever an invoice payment attempt fails, due either to a declined payment or to the lack of a stored payment method.
invoice.payment_succeeded
data.object
is an invoiceOccurs whenever an invoice payment attempt succeeds.
invoice.sent
data.object
is an invoiceOccurs whenever an invoice email is sent out.
invoice.upcoming
data.object
is an invoiceOccurs X number of days before a subscription is scheduled to create an invoice that is automatically charged—where X is determined by your subscriptions settings. Note: The received
Invoice
object will not have an invoice ID.invoice.updated
data.object
is an invoiceOccurs whenever an invoice changes (e.g., the invoice amount).
invoice.voided
data.object
is an invoiceOccurs whenever an invoice is voided.
invoiceitem.created
data.object
is an invoiceitemOccurs whenever an invoice item is created.
invoiceitem.deleted
data.object
is an invoiceitemOccurs whenever an invoice item is deleted.
invoiceitem.updated
data.object
is an invoiceitemOccurs whenever an invoice item is updated.
issuing_authorization.created
data.object
is an issuing authorizationOccurs whenever an authorization is created.
issuing_authorization.requestselection required
data.object
is an issuing authorizationRepresents a synchronous request for authorization, see Using your integration to handle authorization requests. You must create a webhook endpoint which explicitly subscribes to this event type to access it. Webhook endpoints which subscribe to all events will not include this event type.
issuing_authorization.updated
data.object
is an issuing authorizationOccurs whenever an authorization is updated.
issuing_card.created
data.object
is an issuing cardOccurs whenever a card is created.
issuing_card.updated
data.object
is an issuing cardOccurs whenever a card is updated.
issuing_cardholder.created
data.object
is an issuing cardholderOccurs whenever a cardholder is created.
issuing_cardholder.updated
data.object
is an issuing cardholderOccurs whenever a cardholder is updated.
issuing_dispute.closed
data.object
is an issuing disputeOccurs whenever a dispute is won, lost or expired.
issuing_dispute.created
data.object
is an issuing disputeOccurs whenever a dispute is created.
issuing_dispute.funds_reinstated
data.object
is an issuing disputeOccurs whenever funds are reinstated to your account for an Issuing dispute.
issuing_dispute.submitted
data.object
is an issuing disputeOccurs whenever a dispute is submitted.
issuing_dispute.updated
data.object
is an issuing disputeOccurs whenever a dispute is updated.
issuing_transaction.created
data.object
is an issuing transactionOccurs whenever an issuing transaction is created.
issuing_transaction.updated
data.object
is an issuing transactionOccurs whenever an issuing transaction is updated.
mandate.updated
data.object
is a mandateOccurs whenever a Mandate is updated.
order.created
data.object
is an orderOccurs whenever an order is created.
order.payment_failed
data.object
is an orderOccurs whenever an order payment attempt fails.
order.payment_succeeded
data.object
is an orderOccurs whenever an order payment attempt succeeds.
order.updated
data.object
is an orderOccurs whenever an order is updated.
order_return.created
data.object
is an order returnOccurs whenever an order return is created.
payment_intent.amount_capturable_updated
data.object
is a payment intentOccurs when a PaymentIntent has funds to be captured. Check the
amount_capturable
property on the PaymentIntent to determine the amount that can be captured. You may capture the PaymentIntent with anamount_to_capture
value up to the specified amount. Learn more about capturing PaymentIntents.payment_intent.canceled
data.object
is a payment intentOccurs when a PaymentIntent is canceled.
payment_intent.created
data.object
is a payment intentOccurs when a new PaymentIntent is created.
payment_intent.payment_failed
data.object
is a payment intentOccurs when a PaymentIntent has failed the attempt to create a payment method or a payment.
payment_intent.processing
data.object
is a payment intentOccurs when a PaymentIntent has started processing.
payment_intent.requires_action
data.object
is a payment intentOccurs when a PaymentIntent transitions to requires_action state
payment_intent.succeeded
data.object
is a payment intentOccurs when a PaymentIntent has successfully completed payment.
payment_method.attached
data.object
is a payment methodOccurs whenever a new payment method is attached to a customer.
payment_method.automatically_updated
data.object
is a payment methodOccurs whenever a payment method's details are automatically updated by the network.
payment_method.detached
data.object
is a payment methodOccurs whenever a payment method is detached from a customer.
payment_method.updated
data.object
is a payment methodOccurs whenever a payment method is updated via the PaymentMethod update API.
payout.canceled
data.object
is a payoutOccurs whenever a payout is canceled.
payout.created
data.object
is a payoutOccurs whenever a payout is created.
payout.failed
data.object
is a payoutOccurs whenever a payout attempt fails.
payout.paid
data.object
is a payoutOccurs whenever a payout is expected to be available in the destination account. If the payout fails, a
payout.failed
notification is also sent, at a later time.payout.updated
data.object
is a payoutOccurs whenever a payout is updated.
person.created
data.object
is a personOccurs whenever a person associated with an account is created.
person.deleted
data.object
is a personOccurs whenever a person associated with an account is deleted.
person.updated
data.object
is a personOccurs whenever a person associated with an account is updated.
plan.created
data.object
is a planOccurs whenever a plan is created.
plan.deleted
data.object
is a planOccurs whenever a plan is deleted.
plan.updated
data.object
is a planOccurs whenever a plan is updated.
price.created
data.object
is a priceOccurs whenever a price is created.
price.deleted
data.object
is a priceOccurs whenever a price is deleted.
price.updated
data.object
is a priceOccurs whenever a price is updated.
product.created
data.object
is a productOccurs whenever a product is created.
product.deleted
data.object
is a productOccurs whenever a product is deleted.
product.updated
data.object
is a productOccurs whenever a product is updated.
promotion_code.created
data.object
is a promotion codeOccurs whenever a promotion code is created.
promotion_code.updated
data.object
is a promotion codeOccurs whenever a promotion code is updated.
quote.accepted
data.object
is a quoteOccurs whenever a quote is accepted.
quote.canceled
data.object
is a quoteOccurs whenever a quote is canceled.
quote.created
data.object
is a quoteOccurs whenever a quote is created.
quote.finalized
data.object
is a quoteOccurs whenever a quote is finalized.
radar.early_fraud_warning.created
data.object
is an early fraud warningOccurs whenever an early fraud warning is created.
radar.early_fraud_warning.updated
data.object
is an early fraud warningOccurs whenever an early fraud warning is updated.
recipient.created
data.object
is a recipientOccurs whenever a recipient is created.
recipient.deleted
data.object
is a recipientOccurs whenever a recipient is deleted.
recipient.updated
data.object
is a recipientOccurs whenever a recipient is updated.
reporting.report_run.failed
data.object
is a report runOccurs whenever a requested
ReportRun
failed to complete.reporting.report_run.succeeded
data.object
is a report runOccurs whenever a requested
ReportRun
completed succesfully.reporting.report_type.updatedselection required
data.object
is a report typeOccurs whenever a
ReportType
is updated (typically to indicate that a new day's data has come available). You must create a webhook endpoint which explicitly subscribes to this event type to access it. Webhook endpoints which subscribe to all events will not include this event type.review.closed
data.object
is a reviewOccurs whenever a review is closed. The review's
reason
field indicates why:approved
,disputed
,refunded
, orrefunded_as_fraud
.review.opened
data.object
is a reviewOccurs whenever a review is opened.
setup_intent.canceled
data.object
is a setup intentOccurs when a SetupIntent is canceled.
setup_intent.created
data.object
is a setup intentOccurs when a new SetupIntent is created.
setup_intent.requires_action
data.object
is a setup intentOccurs when a SetupIntent is in requires_action state.
setup_intent.setup_failed
data.object
is a setup intentOccurs when a SetupIntent has failed the attempt to setup a payment method.
setup_intent.succeeded
data.object
is a setup intentOccurs when an SetupIntent has successfully setup a payment method.
sigma.scheduled_query_run.created
data.object
is a scheduled query runOccurs whenever a Sigma scheduled query run finishes.
sku.created
data.object
is a skuOccurs whenever a SKU is created.
sku.deleted
data.object
is a skuOccurs whenever a SKU is deleted.
sku.updated
data.object
is a skuOccurs whenever a SKU is updated.
source.canceled
data.object
is a source (e.g., card)Occurs whenever a source is canceled.
source.chargeable
data.object
is a source (e.g., card)Occurs whenever a source transitions to chargeable.
source.failed
data.object
is a source (e.g., card)Occurs whenever a source fails.
source.mandate_notification
data.object
is a source (e.g., card)Occurs whenever a source mandate notification method is set to manual.
source.refund_attributes_required
data.object
is a source (e.g., card)Occurs whenever the refund attributes are required on a receiver source to process a refund or a mispayment.
source.transaction.created
data.object
is a source transactionOccurs whenever a source transaction is created.
source.transaction.updated
data.object
is a source transactionOccurs whenever a source transaction is updated.
subscription_schedule.aborted
data.object
is a subscription scheduleOccurs whenever a subscription schedule is canceled due to the underlying subscription being canceled because of delinquency.
subscription_schedule.canceled
data.object
is a subscription scheduleOccurs whenever a subscription schedule is canceled.
subscription_schedule.completed
data.object
is a subscription scheduleOccurs whenever a new subscription schedule is completed.
subscription_schedule.created
data.object
is a subscription scheduleOccurs whenever a new subscription schedule is created.
subscription_schedule.expiring
data.object
is a subscription scheduleOccurs 7 days before a subscription schedule will expire.
subscription_schedule.released
data.object
is a subscription scheduleOccurs whenever a new subscription schedule is released.
subscription_schedule.updated
data.object
is a subscription scheduleOccurs whenever a subscription schedule is updated.
tax_rate.created
data.object
is a tax rateOccurs whenever a new tax rate is created.
tax_rate.updated
data.object
is a tax rateOccurs whenever a tax rate is updated.
topup.canceled
data.object
is a topupOccurs whenever a top-up is canceled.
topup.created
data.object
is a topupOccurs whenever a top-up is created.
topup.failed
data.object
is a topupOccurs whenever a top-up fails.
topup.reversed
data.object
is a topupOccurs whenever a top-up is reversed.
topup.succeeded
data.object
is a topupOccurs whenever a top-up succeeds.
transfer.created
data.object
is a transferOccurs whenever a transfer is created.
transfer.failed
data.object
is a transferOccurs whenever a transfer failed.
transfer.paid
data.object
is a transferOccurs after a transfer is paid. For Instant Payouts, the event will typically be sent within 30 minutes.
transfer.reversed
data.object
is a transferOccurs whenever a transfer is reversed, including partial reversals.
transfer.updated
data.object
is a transferOccurs whenever a transfer's description or metadata is updated.