Marketplace
It allows the registration of clients, to later carry out the distribution according to the assigned percentage.
https://app.payku.cl/ (Default server) · https://des.payku.cl/ (Sandbox server)Inserting a client
Section titled “Inserting a client”/api/maclientThis method allows the insertion of client data.
Request body
| Parameter | Type | Description |
|---|---|---|
emailrequired |
string <email> | Client email. |
namerequired |
string | Client name |
phonerequired |
string | Client phone. |
bankrequired |
object | |
sbifrequired |
string | Bank code to which the bank account belongs. |
typerequired |
string | Account type.
|
numrequired |
string | Client's account number. |
rutrequired |
string | Single Tax Registry. |
curl -X POST \https://BASE_URL/api/maclient \-H 'Accept: application/json, text/plain, */*' \-H 'Authorization: Bearer TOKEN_PUBLICO' \-H 'Content-Type: application/json' \-H 'Host: BASE_URL' \-d { "email": "[email protected]", "name": "Joe Doe", "phone": "923122312", "bank": { "sbif": "1234", "type": "1", "num": "12312313121", "rut": "111111111" } }'$client = new \GuzzleHttp\Client(); $body = $client->request('POST', 'https://BASE_URL/api/maclient', [ 'json' => [ 'name' => 'Joe Doe', 'phone' => '923122312', 'bank' => [ "sbif" => "0001 ", "type" => "1", "num" => "1231123567", "rut" => "111111111", ] ], 'headers' => [ 'Authorization' => 'Bearer PUBLIC-TOKEN' ] ])->getBody();$response = json_decode($body);const request = async (data) => { const response = await fetch('https://BASE_URL/api/maclient', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer PUBLIC-TOKEN' }, body: JSON.stringify(data) }); const result = await response.json(); console.log(result)}
let data = { name: "Joe Doe", phone: "923122312", bank: { sbif: "1234", type: "1", num: "12312313121", rut: "111111111" }};
request(data);Responses
{ "id": "madb93fc00a2cf6f4449", "status": "register", "name": "Joe Doe", "phone": "923122312", "bank": { "sbif": "1234", "type": "1", "num": "12312313121", "rut": "111111111" }, "affiliations": 0, "created_at": "2020-09-28 20:42:59", "update_at": "null"}Response fields
| Parameter | Type | Description |
|---|---|---|
id |
string | Identifier created by payku. |
status |
string | Client status. |
name |
string | Client name. |
phone |
string | Client phone. |
email |
string <email> | Client email. |
bank |
object | |
sbif |
string | Bank code. |
type |
string | Account type.
|
num |
string | Client's account number. |
rut |
string | Single Tax Registry. |
affiliations |
integer | Number of affiliations. |
created_at |
string <datetime> | Registration date. |
update_at |
string <datetime> | Update date. |
Request failed.
{ "status": "failed", "type": "Unprocessable Entity", "message_error": "subject:invalid,amount:is empty,email:is empty,order:invalid"}Response fields
| Parameter | Type | Description |
|---|---|---|
status |
string | Request status. |
type |
string | Type of error. |
message_error |
string | Error message. |
Incorrect public token.
{ "type": "Unauthorized", "message_error": { "error": "waiting token public" }}Response fields
| Parameter | Type | Description |
|---|---|---|
type |
string | Request status. |
message_error |
object | |
error |
string | Error message. |
Query client data
Section titled “Query client data”/api/maclient/{idClient}This method allows obtaining the details of a client.
Path parameters
| Parameter | Type | Description |
|---|---|---|
idrequired |
string | Unique identifier per payku. |
curl -X GET \https://BASE_URL/api/maclient/id \-H 'Accept: application/json, text/plain, */*' \-H 'Authorization: Bearer TOKEN_PUBLICO' \-H 'Content-Type: application/json' \-H 'Host: BASE_URL' \$client = new \GuzzleHttp\Client(); $body = $client->request('GET', 'https://BASE_URL/api/maclient/madb93fc00a2cf6f4449', [ 'headers' => [ 'Authorization' => 'Bearer PUBLIC-TOKEN' ] ])->getBody();$response = json_decode($body);const request = async () => { const response = await fetch('https://BASE_URL/api/maclient/madb93fc00a2cf6f4449', { method: 'GET', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer PUBLIC-TOKEN' }, }); const result = await response.json(); console.log(result)}
request();Responses
{ "id": "madb93fc00a2cf6f4449", "status": "register", "name": "Joe Doe", "phone": "923122312", "bank": { "sbif": "1234", "type": "1", "num": "12312313121", "rut": "111111111" }, "affiliations": 0, "created_at": "2020-09-28 20:42:59", "update_at": "null"}Response fields
| Parameter | Type | Description |
|---|---|---|
id |
string | Identifier created by payku. |
status |
string | Client status. |
name |
string | Client name. |
phone |
string | Client phone. |
email |
string <email> | Client email. |
bank |
object | |
sbif |
string | Bank code. |
type |
string | Account type.
|
num |
string | Client's account number. |
rut |
string | Single Tax Registry. |
affiliations |
integer | Number of affiliations. |
created_at |
string <datetime> | Registration date. |
update_at |
string <datetime> | Update date. |
Request failed.
{ "status": "failed", "type": "Unprocessable Entity", "message_error": "subject:invalid,amount:is empty,email:is empty,order:invalid"}Response fields
| Parameter | Type | Description |
|---|---|---|
status |
string | Request status. |
type |
string | Type of error. |
message_error |
string | Error message. |
Incorrect public token.
{ "type": "Unauthorized", "message_error": { "error": "waiting token public" }}Response fields
| Parameter | Type | Description |
|---|---|---|
type |
string | Request status. |
message_error |
object | |
error |
string | Error message. |
update client
Section titled “update client”/api/maclient/{idClient}This method allows updating the data of a client.
Path parameters
| Parameter | Type | Description |
|---|---|---|
idrequired |
string | Unique marketplace identifier. |
Request body
| Parameter | Type | Description |
|---|---|---|
name |
string | Client name |
phone |
string | Client phone |
bank |
object | Client bank details |
sbif |
string | Code of the bank to which the bank account belongs. |
type |
int | Account type.
|
num |
string | Client's account number. |
rut |
string | Single Tax Registry. |
curl -X PUT \https://BASE_URL/api/maclient/id \-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":"Joe Doe", "phone":"923122312", "bank": { "sbif": "0001", "type": "3", "num": "9999999", "rut": "261009617" } }'$client = new \GuzzleHttp\Client(); $body = $client->request('PUT', 'https://BASE_URL/api/maclient/madb93fc00a2cf6f4449', [ 'json' => [ 'name' => 'Joe Doe', 'phone' => '923122312', 'bank' => [ 'num' => '9999999', 'rut' => '261009617' ] ], ], ], 'headers' => [ 'Sign' => 'SHA256-REQUEST-PATH-VALUE-PRIVATE-TOKEN', 'Authorization' => 'Bearer PUBLIC-TOKEN' ]])->getBody();$response = json_decode($body);const request = async (data) => { const response = await fetch('https://BASE_URL/api/maclient/madb93fc00a2cf6f4449', { method: 'PUT', headers: { 'Content-Type': 'application/json', 'Sign': 'SHA256-REQUEST-PATH-VALUE-PRIVATE-TOKEN', 'Authorization': 'Bearer PUBLIC-TOKEN' }, body: JSON.stringify(data) }); const result = await response.json(); console.log(result)}
let data = {name:"Joe Doe",phone:"923122312",bank: { sbif: "0001", type: "3", num: "9999999", rut: "261009617" }};
request(data);Responses
{ "id": "cl0be4c8e623c167bc8b777", "status": "register", "name": "Joe Doe", "phone": "923122312", "email": "923122312", "bank": { "sbif": "0001", "type": "3", "num": "9999999", "rut": "261009617" }, "affiliations": 2, "affiliations_details": [ [ { "id": "s6df85b41df65b21se685", "status": "register", "token": "sgh65g1ns6fg5n1sfg2sr6j5nfg65shr6gh5s4r6h5fg6", "name": "market1", "percentage_affiliation": 1, "percentage_client": 99 }, { "id": "s6df85b41df65b21se685", "status": "register", "token": "sgh65g1ns6fg5n1sfg2sr6j5nfg65shr6gh5s4r6h5fg6", "name": "market2", "percentage_affiliation": 1, "percentage_client": 99 } ] ]}Response fields
| Parameter | Type | Description |
|---|---|---|
id |
string | Marketplace identifier. |
status |
string | Client status. |
name |
string | Client name. |
phone |
string | Client phone. |
email |
string | Client email. |
bank |
object | Client bank details. |
sbif |
string | Code of the bank to which the bank account belongs. |
type |
string | Client account type. |
num |
string | Client bank account. |
rut |
string | Client rut |
affiliations |
number | Number of affiliations. |
affiliations_details |
array of objects | |
id |
string | Afiliation identifier. |
status |
string | Afiliation status:
|
token |
string | Afiliation Token. |
name |
string | Afiliation name. |
percentage_affiliation |
string | Afiliation porcentage. |
percentage_client |
string | Cliente porcentage. |
Request failed.
{ "status": "failed", "type": "Unprocessable Entity", "message_error": "subject:invalid,amount:is empty,email:is empty,order:invalid"}Response fields
| Parameter | Type | Description |
|---|---|---|
status |
string | Request status. |
type |
string | Type of error. |
message_error |
string | Error message. |
Incorrect public token.
{ "type": "Unauthorized", "message_error": { "error": "waiting token public" }}Response fields
| Parameter | Type | Description |
|---|---|---|
type |
string | Request status. |
message_error |
object | |
error |
string | Error message. |
Delete client
Section titled “Delete client”/api/maclient/{idClient}This method allows the removal of a client associated with an id.
Path parameters
| Parameter | Type | Description |
|---|---|---|
idrequired |
string | Unique customer identifier per payku. |
curl -X DELETE \https://BASE_URL/api/maclient/id \-H 'Accept: application/json, text/plain, */*' \-H 'Authorization: Bearer TOKEN_PUBLICO' \-H 'Content-Type: application/json' \-H 'Host: BASE_URL' \$client = new \GuzzleHttp\Client(); $body = $client->request('DELETE', 'https://BASE_URL/api/maclient/madb93fc00a2cf6f4449', [ 'headers' => [ 'Authorization' => 'Bearer PUBLIC-TOKEN' ] ])->getBody(); $response = json_decode($body);const request = async () => { const response = await fetch('https://BASE_URL/api/maclient/madb93fc00a2cf6f4449', { method: 'DELETE', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer PUBLIC-TOKEN' }, }); const result = await response.json(); console.log(result)}
request();Responses
{ "status": "suspended", "id": "madb93fc00a2cf6f4449"}Response fields
| Parameter | Type | Description |
|---|---|---|
status |
string | Client status. |
id |
string | Transaction identifier created by payku. |
Request failed.
{ "status": "failed", "type": "Unprocessable Entity", "message_error": "subject:invalid,amount:is empty,email:is empty,order:invalid"}Response fields
| Parameter | Type | Description |
|---|---|---|
status |
string | Request status. |
type |
string | Type of error. |
message_error |
string | Error message. |
Incorrect public token.
{ "type": "Unauthorized", "message_error": { "error": "waiting token public" }}Response fields
| Parameter | Type | Description |
|---|---|---|
type |
string | Request status. |
message_error |
object | |
error |
string | Error message. |
Manage Memberships
Section titled “Manage Memberships”/api/maaffiliationThis method allows you to register the data for membership.
Request body
| Parameter | Type | Description |
|---|---|---|
namerequired |
string | Membership name. |
percentagerequired |
string | Percentage corresponding to the payku user. |
affiliationrequired |
array of anys | Array containing customers, each customer is an array containing a customer identifier created by payku and the percentage that it will get. |
curl -X POST \https://BASE_URL/api/maaffiliation \-H 'Accept: application/json, text/plain, */*' \-H 'Authorization: Bearer TOKEN_PUBLICO' \-H 'Content-Type: application/json' \-H 'Host: BASE_URL' \-d { "name": "name", "percentage": "20", "affiliation": [ ["ma9fd16221a9645b0036","80"] ] }'$client = new \GuzzleHttp\Client(); $body = $client->request('POST', 'https://BASE_URL/api/maaffiliation', [ 'json' => [ 'name' => 'name', 'percentage' => '20', 'affiliation' => [ [ma9fd16221a9645b0036,80] ] ], 'headers' => [ 'Authorization' => 'Bearer PUBLIC-TOKEN' ] ])->getBody();$response = json_decode($body);const request = async (data) => { const response = await fetch('https://BASE_URL/api/maaffiliation', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer PUBLIC-TOKEN' }, body: JSON.stringify(data) }); const result = await response.json(); console.log(result)}
let data = { name: "name", percentage: "20", affiliation: [ ["ma9fd16221a9645b0036","80"] ]};
request(data);Responses
{ "id": "sucaab7865dceaff49d8b3", "status": "register", "name": "name", "token": "eecd92fdbb8bf615e8215d6fbb30bb6ae6f82c9e1810f85b65bbeb472794c4a4", "percentage": "20.00", "affiliations": [ { "id": "ma9fd16221a9645b0036", "name": "name", "percentage": "80.00" } ]}Response fields
| Parameter | Type | Description |
|---|---|---|
id |
string | Unique subscription identifier for payku. |
status |
string | Status. |
name |
string | Membership name. |
token |
string | Affiliate Token that is entered into the merchant. |
percentage |
string | Payku user affiliation percentage. |
affiliations |
array of objects | |
id |
string | Identifier. |
name |
string | Affiliate name. |
percentage |
string | Percentage corresponding to each affiliate. |
Request failed.
{ "status": "failed", "type": "Unprocessable Entity", "message_error": "subject:invalid,amount:is empty,email:is empty,order:invalid"}Response fields
| Parameter | Type | Description |
|---|---|---|
status |
string | Request status. |
type |
string | Type of error. |
message_error |
string | Error message. |
Incorrect public token.
{ "type": "Unauthorized", "message_error": { "error": "waiting token public" }}Response fields
| Parameter | Type | Description |
|---|---|---|
type |
string | Request status. |
message_error |
object | |
error |
string | Error message. |
Check membership data
Section titled “Check membership data”/api/maaffiliation/{idClient}This method allows you to obtain the details of an membership.
Path parameters
| Parameter | Type | Description |
|---|---|---|
idrequired |
string | Unique membership identifier for payku. |
curl -X GET \https://BASE_URL/api/maaffiliation/id \-H 'Accept: application/json, text/plain, */*' \-H 'Authorization: Bearer TOKEN_PUBLICO' \-H 'Content-Type: application/json' \-H 'Host: BASE_URL' \$client = new \GuzzleHttp\Client(); $body = $client->request('GET', 'https://BASE_URL/api/maaffiliation/sucaab7865dceaff49d8b3', [ 'headers' => [ 'Authorization' => 'Bearer PUBLIC-TOKEN' ] ])->getBody();$response = json_decode($body);const request = async () => { const response = await fetch('https://BASE_URL/api/maaffiliation/sucaab7865dceaff49d8b3', { method: 'GET', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer PUBLIC-TOKEN' }, }); const result = await response.json(); console.log(result)}
request();Responses
{ "id": "sucaab7865dceaff49d8b3", "status": "register", "name": "name", "token": "eecd92fdbb8bf615e8215d6fbb30bb6ae6f82c9e1810f85b65bbeb472794c4a4", "percentage": "20.00", "affiliations": [ { "id": "ma9fd16221a9645b0036", "name": "name", "percentage": "80.00" } ]}Response fields
| Parameter | Type | Description |
|---|---|---|
id |
string | Unique subscription identifier for payku. |
status |
string | Status. |
name |
string | Membership name. |
token |
string | Affiliate Token that is entered into the merchant. |
percentage |
string | Payku user affiliation percentage. |
affiliations |
array of objects | |
id |
string | Identifier. |
name |
string | Affiliate name. |
percentage |
string | Percentage corresponding to each affiliate. |
Request failed.
{ "status": "failed", "type": "Unprocessable Entity", "message_error": "subject:invalid,amount:is empty,email:is empty,order:invalid"}Response fields
| Parameter | Type | Description |
|---|---|---|
status |
string | Request status. |
type |
string | Type of error. |
message_error |
string | Error message. |
Incorrect public token.
{ "type": "Unauthorized", "message_error": { "error": "waiting token public" }}Response fields
| Parameter | Type | Description |
|---|---|---|
type |
string | Request status. |
message_error |
object | |
error |
string | Error message. |
Remove membership
Section titled “Remove membership”/api/maaffiliation/{idClient}This method allows the removal of an membership associated with an id.
Path parameters
| Parameter | Type | Description |
|---|---|---|
idrequired |
string | Unique client identifier per payku. |
curl -X DELETE \https://BASE_URL/api/maaffiliation/id \-H 'Accept: application/json, text/plain, */*' \-H 'Authorization: Bearer TOKEN_PUBLICO' \-H 'Content-Type: application/json' \-H 'Host: BASE_URL' \$client = new \GuzzleHttp\Client(); $body = $client->request('DELETE', 'https://BASE_URL/api/maaffiliation/madb93fc00a2cf6f4449', [ 'headers' => [ 'Authorization' => 'Bearer PUBLIC-TOKEN' ] ])->getBody(); $response = json_decode($body);const request = async () => { const response = await fetch('https://BASE_URL/api/maaffiliation/sucaab7865dceaff49d8b3', { method: 'DELETE', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer PUBLIC-TOKEN' }, }); const result = await response.json(); console.log(result)}
request();Responses
{ "status": "suspended", "id": "eecd92fdbb8bf615e821"}Response fields
| Parameter | Type | Description |
|---|---|---|
status |
string | Membership status. |
id |
string | Transaction identifier created by payku. |
Request failed.
{ "status": "failed", "type": "Unprocessable Entity", "message_error": "subject:invalid,amount:is empty,email:is empty,order:invalid"}Response fields
| Parameter | Type | Description |
|---|---|---|
status |
string | Request status. |
type |
string | Type of error. |
message_error |
string | Error message. |
Incorrect public token.
{ "type": "Unauthorized", "message_error": { "error": "waiting token public" }}Response fields
| Parameter | Type | Description |
|---|---|---|
type |
string | Request status. |
message_error |
object | |
error |
string | Error message. |
Generate a Marketplace transaction
Section titled “Generate a Marketplace transaction”/api/transaction/This method allows to create a payment order to Payku and receives as a response the URL to redirect the payer's browser and the token that identifies the transaction. Once the payer makes the successful payment, Payku will notify the result to the page of the business that was sent in the urlnotify parameter.
Request body
| Parameter | Type | Description |
|---|---|---|
emailrequired |
string <email> | Client email. |
orderrequired |
string | Trade order. |
subjectrequired |
string | Description of the order. |
amountrequired |
integer | Order amount. |
payment |
integer | Identifier of the payment method. If the identifier is sent, the payer will be redirected directly to the indicated means of payment.
|
urlreturn |
string <url> | return url of the trade where payku will redirect the payer. |
urlnotify |
string <url> | Callback url of the business where payku will notify the payment. |
marketplace |
string | Mandatory attribute to make transactions to Marketplace affiliation, this consists of the token of the marketplace affiliation to which you want to carry out the transaction. |
curl -X POST \https://BASE-URL/api/transaction \-H 'Accept: application/json, text/plain, */*' \-H 'Authorization: Bearer PUBLIC-TOKEN' \-H 'Content-Type: application/json' \-H 'Host: BASE-URL' \-d '{ "email": "[email protected]", "order": "5696" "subject": "Cliente Test", "amount": 25000, "payment": 1, "urlreturn": "https://youwebsite.com/urlreturn?orderClient=123", "urlnotify": "https://youwebsite.com/urlnotify?orderClient=123", "marketplace": "c1c879f4862d393ea6b326a313022dd98f0baa2869d3e9095c124199c9941030"}'$client = new \GuzzleHttp\Client(); $body = $client->request('POST', 'https://BASE_URL/api/transaction', [ 'json' => [ 'order' => "98745", 'subject' => 'Client Test', 'amount' => 25000, 'payment' => 1, 'urlreturn' => 'https://youwebsite.com/urlreturn?orderClient=123', 'urlnotify' => 'https://youwebsite.com/urlnotify?orderClient=123', 'marketplace' => 'c1c879f4862d393ea6b326a313022dd98f0baa2869d3e9095c124199c9941030' ], 'headers' => [ 'Authorization' => 'Bearer PUBLIC-TOKEN' ] ])->getBody();$response = json_decode($body);const request = async (data) => { const response = await fetch('https://BASE_URL/api/transaction', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer PUBLIC-TOKEN' }, body: JSON.stringify(data) }); const result = await response.json(); console.log(result)}
let data = { order: "98745", subject: "test subject", amount: 25000, payment: 1, urlreturn: "https://youwebsite.com/urlreturn?orderClient=123", urlnotify: "https://youwebsite.com/urlnotify?orderClient=123", marketplace: c1c879f4862d393ea6b326a313022dd98f0baa2869d3e9095c124199c9941030};
request(data);Responses
{ "status": "pending", "id": "ma32cb779c0a777fc68", "url": "https://BASE-URL/payment_url"}Response fields
| Parameter | Type | Description |
|---|---|---|
status |
string | Transaction status The possible statuses you can get are the following:
|
id |
string | Transaction identifier created by payku. |
url |
string | URL to redirect the user. |
Request failed.
{ "status": "failed", "type": "Unprocessable Entity", "message_error": "subject:invalid,amount:is empty,email:is empty,order:invalid"}Response fields
| Parameter | Type | Description |
|---|---|---|
status |
string | Request status. |
type |
string | Type of error. |
message_error |
string | Error message. |
Incorrect public token.
{ "type": "Unauthorized", "message_error": { "error": "waiting token public" }}Response fields
| Parameter | Type | Description |
|---|---|---|
type |
string | Request status. |
message_error |
object | |
error |
string | Error message. |