Skip to content

Consumption Subscription

It is the set of methods that will allow our users to create clients, plans, subscriptions and carry out consumer plan transactions.

The main use of these methods is to make one-time charges to a customer for a service or product, such as hiring a delivery service for a product or the purchase of a particular product.

Base URL: https://app.payku.cl/ (Default server) · https://des.payku.cl/ (Sandbox server)
POST/api/suclient/

This method allows the insertion of Client data.

Request body

ParameterTypeDescription
emailrequired string <email>

Client email.

maximum 50 characters
namerequired string

Client name

maximum 80 characters
Example: Joe Doe
rut string

Single Tax Registry of the client, the entry of this data with or without a hyphen will be allowed.

12 characters required
Example: 11111111
phonerequired string

Client phone.

20 characters required
Example: 923122312
address string

Client address.

maximum 200 characters
Example: Moneda 101
country string

Client country.

maximum 40 characters
Example: Chile
region string

Client region.

maximum 120 characters
Example: Metropolitana
city string

Client city.

maximum 40 characters
Example: Santiago
postal_code string

Client Zip Code.

maximum 10 characters
Example: 850000
additional_parameters object

Client additional parameters

maximum 4000 characters
parameter_1 string

Client additional parameter

Example: example
parameter_2 string

Client additional parameter

Example: example
curl -X POST \
https://BASE_URL/api/suclient \
-H 'Accept: application/json, text/plain, */*' \
-H 'Sign: SIGN' \
-H 'Authorization: Bearer TOKEN_PUBLICO' \
-H 'Content-Type: application/json' \
-H 'Host: BASE_URL' \
-d {
"email": "[email protected]",
"name": "Joe Doe",
"rut": "111111111",
"phone": "923122312",
"address": "Moneda 101",
"country": "Chile",
"region": "Metropolitana",
"city": "Santiago",
"postal_code": "850000,
"additional_parameters":{
"parameter_1": "example 1",
"parameter_2": "example 2",
}
}'

Responses

200
{
"status": "active",
"id": "cl0be4c8e623c167bc8b29",
"rut": "11111111",
"name": "Joe Doe",
"phone": "923122312",
"email": "[email protected]",
"address": "Moneda 101",
"country": "Chile",
"region": "Metropolitana",
"city": "Santiago",
"postal_code": "850000",
"create_at": "2020-09-29",
"update_at": null,
"subcriptions": null,
"additional_parameters": {
"parameter_1": "example",
"parameter_2": "example"
}
}
Response fields
ParameterTypeDescription
status string

Client status.

Example: active
id string

Identifier of the transaction created by payku.

Example: cl0be4c8e623c167bc8b29
rut string

Single Tax Registry of the client.

Example: 11111111
name string

Client name.

Example: Joe Doe
phone string

Client phone.

Example: 923122312
email string

Client email.

address string

Client address.

Example: Moneda 101
country string

Client country.

Example: Chile
region string

Client region.

Example: Metropolitana
city string

Client city.

Example: Santiago
postal_code string

Client Zip Code.

Example: 850000
create_at string <datetime>

Registration date.

Example: 2020-09-29
update_at string <datetime>

Update date.

subcriptions object

Client subscriptions.

additional_parameters object

Client additional parameters

parameter_1 string

Client additional parameter

Example: example
parameter_2 string

Client additional parameter

Example: example
POST/api/suplan/

This method allows the insertion of data for the creation of a plan.

Request body

ParameterTypeDescription
namerequired string

Plan name.

maximum 20 characters
Example: Test plan
description string

Plan description.

maximum 1000 characters
Example: Test Plan
url_notify_suscription string <url>

URL where the subscription status will be notified.

maximum 240 characters
Example: https://youwebsite.com/urlnotifysuscription
url_notify_payment string <url>

URL where the payment status will be notified.

maximum 240 characters
Example: https://youwebsite.com/urlnotifypayment
url_success_payment string <url>

URL where the user will be redirected if the payment is successful.

maximum 240 characters
Example: https://youwebsite.com/urlsuccesspayment
url_failed_payment string <url>

URL where the user will be redirected if the payment is unsuccessful.

maximum 240 characters
Example: https://youwebsite.com/urlfailedpayment
curl -X POST \
https://BASE_URL/api/suplan \
-H 'Accept: application/json, text/plain, */*' \
-H 'Sign: SIGN' \
-H 'Authorization: Bearer TOKEN_PUBLICO' \
-H 'Content-Type: application/json' \
-H 'Host: BASE_URL' \
-d {
"name": "Test plan",
"description": "Test Plan"
}'

Responses

200
{
"status": "success",
"id": "pl4293e97a87195bb9edcd"
}
Response fields
ParameterTypeDescription
status string

Status.

Example: success
id string

Unique plan identifier per payku.

Example: pl4293e97a87195bb9edcd
POST/api/sususcription/

This method allows the user of a Payku account to create a subscription to a fixed-amount subscription plan, a consumer plan subscription and a variable-amount subscription to one of its clients, for this last type of subscription it is necessary to send the amount that will be charged in the subscription, it is important to note that when making this request for the first time there will be a charge of $ 50 that allows verifying that the card is active and valid, in the case of a fixed subscription plan the service charge will be automatic From the month following the subscription date and in the event that the subscription is to a consumer plan, it will be necessary to use the api / sutransaction endpoint to generate the transaction.

Request body

ParameterTypeDescription
planrequired string

Plan id.

maximum 70 characters
Example: pl9697fb170834ad42dd00
clientrequired string

Client id.

maximum 20 characters
Example: cl9b1e1dd988694f30fa30
curl -X POST \
https://BASE_URL/api/sususcription \
-H 'Accept: application/json, text/plain, */*' \
-H 'Sign: SIGN' \
-H 'Authorization: Bearer TOKEN_PUBLICO' \
-H 'Content-Type: application/json' \
-H 'Host: BASE_URL' \
-d {
"plan": "pl9697fb170834ad42dd00",
"client": "cl9b1e1dd988694f30fa30"
}'

Responses

200
{
"status": "register",
"id": "sucaab7865dceaff49d8b3",
"url": "http://app.payku.cl/gateway/registrosuscripcion?tipoplan=2&plan=true&token=219&validacion=e6c50ba0e0"
}
Response fields
ParameterTypeDescription
status string

Status.

Example: register
id string

Unique subscription identifier for payku.

Example: sucaab7865dceaff49d8b3
url string

Url payment and subscription activation.

Example: http://app.payku.cl/gateway/registrosuscripcion?tipoplan=2&plan=true&token=219&validacion=e6c50ba0e0
POST/api/sutransaction/

This method allows the user of a Payku account to generate a unique transaction to one of his clients who are subscribed to a consumption plan.

Request body

ParameterTypeDescription
suscriptionrequired string

Unique subscription identifier for payku.

maximum 60 characters
Example: sucaab7865dceaff49d8b3
amount string

Amount.

maximum 14 digits
Example: 10000
order string

Order.

maximum 40 characters
Example: 001
description string

Description.

maximum 1000 characters
Example: Description
marketplace string

ma0690b6451a7043d5.

20 characters
Example: ma0690b6451a7043d5
card string

With the identifier you can indicate which of the active cards will be charged (OPTIONAL).

maximum 28 characters
Example: surea041d8a4413949425fec
curl -X POST \
https://BASE_URL/api/sutransaction \
-H 'Accept: application/json, text/plain, */*' \
-H 'Sign: SIGN' \
-H 'Authorization: Bearer TOKEN_PUBLICO' \
-H 'Content-Type: application/json' \
-H 'Host: BASE_URL' \
-d {
"suscription": "sucaab7865dceaff49d8b3",
"amount": "10000",
"order": "001",
"description": "Description",
"marketplace": "ma0690b6451a7043d5"
}'

Responses

200
{
"status": "success",
"order": "001",
"amount": "10000",
"transaction_id": "204444",
"verification_key": "025dcad37e071daa8bfc2df35189009db65692a4ff766856108be1675e870839"
}
Response fields
ParameterTypeDescription
status string

Transaction status. The possible statuses you can get are the following:

  • pending
  • success
  • rejected
  • refunded partial
  • refunded
Example: success
order string

Order.

Example: 001
amount string

Amount.

Example: 10000
transaction_id string

Transaction number.

Example: 204444
verification_key string
Example: 025dcad37e071daa8bfc2df35189009db65692a4ff766856108be1675e870839
POST/api/suscriptionsdeletecards/

This method allows you to delete a card associated with the subscription.

Request body

ParameterTypeDescription
suscriptionrequired string

ID of the associated card.

maximum 60 characters
Example: surec804a8ed60c0a8cb8839
curl -X POST \
https://BASE_URL/api/suscriptionsdeletecards \
-H 'Accept: application/json, text/plain, */*' \
-H 'Sign: SHA256-REQUEST-PATH-VALUE-PRIVATE-TOKEN' \
-H 'Authorization: Bearer PUBLIC_TOKEN' \
-H 'Content-Type: application/json' \
-H 'Host: BASE_URL' \
-d {
"card": "surec804a8ed60c0a8cb8839"
}'

Responses

200
{
"status": "Delete",
"card": "surec804a8ed60c0a8cb8839"
}
Response fields
ParameterTypeDescription
status string

Status.

Example: Delete
card string

Identificador único de La tarjeta asociada a la suscripción.

Example: surec804a8ed60c0a8cb8839