Authorization: Bearer partner@mail.com:TOKEN
{
"id": "uniq_string",
"amount": {
"amount": 1000,
"currency": "RUB"
},
"expire": "2020-06-17T15:45:41.000+03:00",
"description": "...",
"projectCode": "myproject",
"sender": {
"name": "...",
"phone": "...",
"email": "...",
"comment": "..."
},
"contentUrl": "...",
"custom": {
"id": 1,
"shopName": "myshop",
"shopDescription": "Clothes",
// Любой набор параметров
},
"successUrl": "https://my-site.com/payment/success",
"failUrl": "https://my-site.com/payment/error"
}
{
"amount": {
"amount": 1000,
"commission": 0,
"currency": "RUB"
},
"created_at": "2019-09-22T13:50:16.119Z",
"description": "...",
"id": "some_string",
"projectId": 6,
"status": "CREATED",
"payUrl": "https://get.capusta.space/bill/uuid"
}
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace CapustaNetCore
{
static class Program
{
public class PaymentRequest
{
public class AmountObj
{
[JsonPropertyName("currency")]
public string Currency { get; set; }
[JsonPropertyName("amount")]
public long Amount { get; set; }
}
[JsonPropertyName("projectCode")]
public string ProjectCode { get; set; }
[JsonPropertyName("description")]
public string Description { get; set; }
[JsonPropertyName("amount")]
public AmountObj Amount { get; set; }
}
static async Task Main()
{
string email = "YOUR_EMAIL";
string token = "YOUR_TOKEN";
var request = new PaymentRequest
{
ProjectCode = "YOUR_PROJECT_CODE",
Description = "It's easy, man!",
Amount = new PaymentRequest.AmountObj
{
Amount = 1000L,
Currency = "RUB"
}
};
var serializedData = JsonSerializer.Serialize(request);
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {email}:{token}");
var response = await client.PostAsync("https://api.capusta.space/v1/partner/payment",
new StringContent(serializedData, Encoding.UTF8, "application/json")).ConfigureAwait(false);
response.EnsureSuccessStatusCode();
var data = await response.Content.ReadAsStringAsync();
Console.WriteLine(data);
Console.ReadLine();
}
}
}
}
<?php
$email = 'YOUR_EMAIL_HERE';
$token = 'YOUR_TOKEN_HERE';
$projectCode = 'YOUR_PROJECT_CODE_HERE';
$amount = 1000; //minimum 10 rub!
$headers = [
'Authorization: Bearer '.$email . ':' . $token,
'Content-Type: application/json; charset=utf-8',
];
$url = "https://api.capusta.space/v1/partner/payment"; //payment url
$requestArray = [
'projectCode' => $projectCode,
'amount' => [
'currency' => 'RUB',
'amount' => $amount,
],
'description' => 'its easy, man!',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,json_encode($requestArray));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec ($ch);
curl_close ($ch);
print $server_output ;
import requests
EMAIL = 'YOUR_EMAIL_HERE'
TOKEN = 'YOUR_TOKEN_HERE'
PROJECT_CODE = 'YOUR_PROJECT_CODE_HERE'
url = 'https://api.capusta.space/v1/partner/payment'
payload = {
'projectCode': PROJECT_CODE,
'amount': {
'currency': 'RUB',
'amount': 1000
},
'description': 'its easy, man!'
}
headers = {
'Authorization': f'Bearer {EMAIL}:{TOKEN}',
}
response = requests.request("POST", url, json=payload, headers=headers)
print(response.json())
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
public class Main {
public static void main(String... args) throws IOException {
String email = "YOUR_EMAIL_HERE";
String token = "YOUR_TOKEN_HERE";
String projectCode = "YOUR_PROJECT_CODE_HERE";
long amount = 1000L; //minimum 10 rub!
JSONObject request = new JSONObject();
request.put("projectCode", projectCode);
request.put("description", "its easy, man!");
JSONObject amountObject = new JSONObject();
amountObject.put("amount", amount);
amountObject.put("currency", "RUB");
request.put("amount", amountObject);
URL url = new URL("https://api.capusta.space/v1/partner/payment"); // payment url
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setDoOutput(true);
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json; utf-8");
con.setRequestProperty("Authorization", "Bearer " + email + ":" + token);
try(OutputStream os = con.getOutputStream()) {
byte[] input = request.toString().getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}
try(BufferedReader br = new BufferedReader(
new InputStreamReader(con.getInputStream(), StandardCharsets.UTF_8))) {
StringBuilder response = new StringBuilder();
String responseLine = null;
while ((responseLine = br.readLine()) != null) {
response.append(responseLine.trim());
}
System.out.println(response.toString());
}
con.disconnect();
}
}
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20201115</version>
</dependency>
{
"id": "uniq_string",
"amount": {
"amount": 1000,
"currency": "RUB"
},
"expire": "2020-06-17T15:45:41.000+03:00",
"description": "...",
"projectCode": "myproject",
"sender": {
"name": "...",
"phone": "...",
"email": "...",
"comment": "..."
},
"contentUrl": "...",
"custom": {
"id": 1,
"shopName": "myshop",
"shopDescription": "Clothes",
// Любой набор параметров
},
"successUrl": "https://my-site.com/payment/success",
"failUrl": "https://my-site.com/payment/error"
}
{
"amount": {
"amount": 1000,
"currency": "RUB"
},
"projectCode": "myproject",
"subscription": {
"per": "MONTHLY",
"oneTimePayment": true,
"trialDays": 3
}
}
{
"projectCode": "myproject",
"billTariffs": [
{
"amount": {
"amount": 1000,
"currency": "RUB"
},
"name": "test1",
"description": "test1"
},
{
"amount": {
"amount": 2000,
"currency": "RUB"
},
"name": "tes2t",
"description": "test2",
"contentUrl": "https://www.youtube.com/watch?v=nDbidIKDBPs"
},
{
"amount": {
"amount": 2000,
"currency": "RUB"
},
"name": "tes2t",
"description": "test2",
"contentUrl": "https://www.youtube.com/watch?v=nDbidIKDBPs",
"subscription": {
"per": "WEEKLY",
"oneTimePayment": false
}
}
]
}
{
"id": "uniq_string",
"amount": {
"amount": 100000,
"currency": "RUB"
},
"expire": "2020-06-17T15:45:41.000+03:00",
"description": "...",
"projectCode": "myproject",
"tipPercents": [
3,
5,
7
]
}
{
"id": "uniq_string",
"amount": {
"amount": 1000,
"currency": "RUB"
},
"description": "...",
"projectCode": "myproject",
"sender": {
"name": "...",
"phone": "...",
"email": "...",
"comment": "...",
}
}
{
"id": "your-transaction-id",
"amount": {
"amount": 10000,
"currency": "RUB"
},
"projectCode": "lalala",
"pan": "1111111111111111",
"description": "any description"
}
{
"id": "some_string",
"amount": {
"amount": 10000,
"currency": "RUB"
},
"projectCode": "lalala"
}
https://api.capusta.space/v1/partner/payout/commission?project-code=kotiki&pan=4200000000000000&amount=100000
{
"amount": 100000,
"commission": 5000,
"pan": 4200000000000000,
"projectCode": "kotiki"
}
{
"transactionId": "string",
"projectCode": "string",
"reason": "string",
"email": "string"
}
{
"refundId": "string",
"amount": 1000,
"commission": 5000
}
GET /status?transaction-id=...
https://api.capusta.space/v2/partner/status?transaction-id=e0cb82ac-7be5
{
"id": "e0cb82ac-7be5",
"transactionId": "e0cb82ac-7be5",
"partnerPaymentId": null,
"amount": {
"amount": 1000,
"commission": 0,
"currency": "RUB"
},
"status": "NEW",
"description": "test",
"contentUrl": null,
"projectId": 1,
"projectCode": "test",
"payUrl": "https://capu.st/bille0cb82ac-7be5",
"sender": null,
"expire": null,
"custom": "{\"id\":1,\"shopname\":\"test_shop\",\"description\":\"shop_description\"}",
"multiBill": true,
"billPaymentEnabled": true,
"createdAt": "2020-05-15T06:43:42.000+0000",
"transactions": [
{
"id": "d4431bfc-f261",
"amount": {
"amount": 1000,
"commission": 0,
"currency": "RUB"
},
"status": "SUCCESS",
"createdAt": "2020-09-07T16:24:37.000+0000",
"updatedAt": "2020-09-07T16:24:37.000+0000"
}
],
"totalTransactionCount": 1,
"transactionCountPerPage": 25
}
https://api.capusta.space/v2/partner/status?transaction-id=e0cb82ac-7be5?page=2
{
"id": "e0cb82ac-7be5",
"transactionId": "e0cb82ac-7be5",
"partnerPaymentId": null,
"amount": {
"amount": 1000,
"commission": 0,
"currency": "RUB"
},
"status": "NEW",
"description": "test",
"contentUrl": null,
"projectId": 1,
"projectCode": "test",
"payUrl": "https://capu.st/bille0cb82ac-7be5",
"sender": null,
"expire": null,
"custom": "{\"id\":1,\"shopname\":\"test_shop\",\"description\":\"shop_description\"}",
"multiBill": true,
"billPaymentEnabled": true,
"createdAt": "2020-05-15T06:43:42.000+0000",
"transactions": [
{
"id": "d4431bfc-f261",
"amount": {
"amount": 1000,
"commission": 0,
"currency": "RUB"
},
"status": "SUCCESS",
"createdAt": "2020-09-07T16:24:37.000+0000",
"updatedAt": "2020-09-07T16:24:37.000+0000"
},
{
"id": "d4431bfc-f262",
"amount": {
"amount": 10000,
"commission": 0,
"currency": "RUB"
},
"status": "SUCCESS",
"createdAt": "2020-10-07T16:24:37.000+0000",
"updatedAt": "2020-10-07T16:24:37.000+0000"
},
{
"id": "d4431bfc-f263",
"amount": {
"amount": 100000,
"commission": 0,
"currency": "RUB"
},
"status": "SUCCESS",
"createdAt": "2020-11-07T16:24:37.000+0000",
"updatedAt": "2020-11-07T16:24:37.000+0000"
}
],
"totalTransactionCount": 28,
"transactionCountPerPage": 25
}
{
"id": "22738e1c-5945",
"amount": {
"amount": 5000,
"commission": 5000,
"currency": "RUB"
},
"description": "",
"projectId": 91,
"projectCode": null,
"contentUrl": null,
"sender": null,
"custom": null,
"expire": null,
"testPayment": false,
"status": "SUCCESS",
"payUrl": null,
"created_at": "2020-04-16T12:40:43.000+0000",
"updated_at": "2020-04-16T12:40:43.000+0000"
}
https://api.capusta.space/v2/partner/status?transaction-id=e0cb82ac-7be5&withFailed=true
{
"publicId": "e0cb82ac-7be5",
"partnerPaymentId": "e0cb82ac-7be5",
"amount": {
"amount": 1000,
"commission": 0,
"currency": "RUB"
},
"status": "NEW",
"description": "test",
"contentUrl": null,
"projectId": 1,
"projectCode": "test",
"payUrl": "https://capu.st/bille0cb82ac-7be5",
"sender": null,
"expire": null,
"custom": "{\"id\":1,\"shopname\":\"test_shop\",\"description\":\"shop_description\"}",
"multiBill": true,
"billPaymentEnabled": true,
"createdAt": "2020-05-15T06:43:42.000+0000",
"transactions": [
{
"id": "d4431bfc-f261",
"amount": {
"amount": 1000,
"commission": 0,
"currency": "RUB"
},
"status": "DECLINE",
"failureDescription": "Отказ банка в совершении операции. Причина не детализирована.",
"createdAt": "2020-09-07T16:24:37.000+0000",
"updatedAt": "2020-09-07T16:24:37.000+0000"
}
]
}
{
"amount": {
"amount": 1000,
"commission": 0,
"currency": "RUB"
},
"transactionId": "some_string",
"status": "SUCCESS",
"custom": {
"id": 1,
"shopName": "myshop",
"shopDescription": "Clothes",
// Любой набор параметров
},
"signature":"4540f5a2853803eb409ddbd60dae63c3"
}
{
"amount": {
"amount": 1000,
"commission": 0,
"currency": "RUB"
},
"transactionId": "some_string",
"billId": "some_string",
"status": "SUCCESS",
"custom": {
"id": 1,
"shopName": "myshop",
"shopDescription": "Clothes",
// Любой набор параметров
},
"signature":"4540f5a2853803eb409ddbd60dae63c3"
}
{
"callbackId": 4536,
"amount": {
"amount": 100000,
"currency": "RUB",
"commission": 0
},
"accountNumber": "420000xxxxxx0000",
"status": "INACTIVE",
"setupTransactionId": "c7166aee-0ff9",
"subscriberId": 123,
"signature": "61de2b5d782f60aedde677d3b944ddaf",
"per": "MONTHLY"
}
"sender": {"name": "name","email": "email","lastname":null}
"sender_emailemailsender_namename"
{
"transactionId":"ef79befc-ae42",
"amount":{
"amount":200000,
"currency":"RUB",
"commission":0
},
"status":"SUCCESS",
"sender":{
"name":"Петр",
"lastname":null,
},
"signature":"4540f5a2853803eb409ddbd60dae63c3"
}
amount_amount200000amount_commission0amount_currencyRUBsender_nameПетрstatusSUCCESStransactionIdef79befc-ae42
amount_amount200000amount_commission0amount_currencyRUBsender_nameПетрstatusSUCCESStransactionIdef79befc-ae42test@test.ruabcd-efgh
GET /balance?project-code=...
{
"balance": 121500,
"currency": "RUB"
}
GET /registry?projectId=1
&from=2020-02-17T12:19:47.000%2B04:00
&to=2020-02-17T14:19:47.000%2B04:00
GET /registry?projectCode=kotiki
&from=2020-02-17T12:19:47.000%2B04:00
&to=2020-02-17T14:19:47.000%2B04:00
GET /registry?projectId=1
&from=2020-02-17T12:19:47.000%2B04:00
&to=2020-02-17T14:19:47.000%2B04:00
GET /registry?projectId=1
&from=2020-02-17T12:19:47.000-04:00
&to=2020-02-17T14:19:47.000-04:00
[
{
"id": "test123",
"transactionId": "b69d3fd8-b138",
"partnerPaymentId": "test123",
"amount": {
"amount": 1000,
"commission": 0,
"currency": "RUB"
},
"description": null,
"projectId": 1,
"projectCode": "test",
"contentUrl": null,
"sender": null,
"custom": null,
"expire": null,
"status": "SUCCESS",
"parent_id": null,
"payUrl": "https://capu.st/billb69d3fd8-b138",
"created_at": "2020-09-07T16:24:11.000+0000",
"updated_at": "2020-09-07T16:24:11.000+0000"
},
{
"id": "d4431bfc-f261",
"transactionId": "d4431bfc-f261",
"partnerPaymentId": null,
"amount": {
"amount": 1000,
"commission": 0,
"currency": "RUB"
},
"description": null,
"projectId": 1,
"projectCode": "test",
"contentUrl": null,
"sender": null,
"custom": null,
"expire": null,
"status": "SUCCESS",
"parent_id": null,
"payUrl": "https://capu.st/billd4431bfc-f261",
"created_at": "2020-09-07T16:24:37.000+0000",
"updated_at": "2020-09-07T16:24:37.000+0000"
}
]
GET /registry?projectId=1
&from=2020-02-17T12:19:47.000%2B04:00
&to=2020-02-17T14:19:47.000%2B04:00
&withFailed=true
[
{
"id": "b69d3fd8-b138",
"amount": {
"amount": 1000,
"commission": 0,
"currency": "RUB"
},
"description": null,
"projectId": 1,
"projectCode": "test",
"partnerPaymentId": null,
"contentUrl": null,
"sender": null,
"custom": null,
"expire": null,
"status": "SUCCESS",
"failureDescription": null,
"parent_id": null,
"created_at": "2020-09-07T16:24:11.000+0000",
"updated_at": "2020-09-07T16:24:11.000+0000"
},
{
"id": "d4431bfc-f261",
"amount": {
"amount": 1000,
"commission": 0,
"currency": "RUB"
},
"description": null,
"projectId": 1,
"projectCode": "test",
"partnerPaymentId": null,
"contentUrl": null,
"sender": null,
"custom": null,
"expire": null,
"status": "DECLINE",
"failureDescription": "Отказ банка в совершении операции. Причина не детализирована.",
"parent_id": null,
"created_at": "2020-09-07T16:24:37.000+0000",
"updated_at": "2020-09-07T16:24:37.000+0000"
}
]
GET /registry?projectId=1
&from=2020-02-17T12:19:47.000%2B04:00
&to=2020-02-17T14:19:47.000%2B04:00
&includeTestTransactions=true
https://api.capusta.space/v2/partner/subscribers?project-code=kotiki
https://api.capusta.space/v2/partner/subscribers?project-code=kotiki&email=rysin@capusta.space
https://api.capusta.space/v2/partner/subscribers?project-code=kotiki&subscriberId=1
{
"count": 3,
"countPerPage": 35,
"page": 1,
"subscribers": [
{
"id": 797,
"accountNumber": "420000xxxxxx0000",
"name": null,
"email": "test@gmail.com",
"overallAmount": 3000000,
"status": "INACTIVE",
"projectId": 1,
"projectCode": "kotiki",
"createdAt": "2021-03-04T12:09:16.000+0000",
"nextDeliverAt": "2021-03-10T12:09:16.000+0000",
"billTariff": {
"id": 24408,
"amount": 3000000,
"commission": 0,
"name": "бизнес",
"description": "прокат на месяц",
"contentUrl": "https://www.youtube.com/watch?v=nKMk3q7bHjA",
"subscription": {
"id": 928,
"per": "MONTHLY",
"oneTimePayment": false
},
"subscriberCount": 0
},
"billCode": null,
"setupPaymentId": "b96897bf-dc12",
"setupPartnerPaymentId": null
},
{
"id": 794,
"accountNumber": "600000xxxxxx0007",
"name": null,
"email": "test@gmail.com",
"overallAmount": 3165000,
"status": "INACTIVE",
"projectId": 1,
"projectCode": "kotiki",
"createdAt": "2021-03-04T12:09:16.000+0000",
"nextDeliverAt": "2021-03-10T12:09:16.000+0000",
"billTariff": {
"id": 24408,
"amount": 3000000,
"commission": 0,
"name": "бизнес",
"description": "прокат на месяц",
"contentUrl": "https://www.youtube.com/watch?v=nKMk3q7bHjA",
"subscription": {
"id": 928,
"per": "MONTHLY",
"oneTimePayment": false
},
"subscriberCount": 0
},
"billCode": "23as45ef-3a48",
"setupPaymentId": "10f97b7e-8188",
"setupPartnerPaymentId": null
},
{
"id": 792,
"accountNumber": "420000xxxxxx0000",
"name": null,
"email": "test@gmail.com",
"overallAmount": 11391100,
"status": "INACTIVE",
"projectId": 1,
"projectCode": "kotiki",
"createdAt": "2021-03-04T12:09:16.000+0000",
"nextDeliverAt": "2021-03-10T12:09:16.000+0000",
"billTariff": {
"id": 24470,
"amount": 11111100,
"commission": 0,
"name": "test",
"description": "test",
"contentUrl": "https://www.youtube.com/watch?v=nDbidIKDBPs",
"subscription": {
"id": 942,
"per": null,
"oneTimePayment": false
},
"subscriberCount": 0
},
"billCode": "23as45ef-3a48",
"setupPaymentId": "18fb2cea-1e21",
"setupPartnerPaymentId": null
}
]
}
https://api.capusta.space/v2/partner/subscribers?project-code=kotiki&page=2
{
"id": "uniq_string",
"amount": {
"amount": 1000,
"currency": "RUB"
},
"description": "...",
"projectCode": "myproject",
"test": true
}
{
"email": "user@capusta.space",
"projectLink": "https://project.link",
"callbackUrl": "https://project.link/callback",
"failUrl": "https://project.link/fail",
"successUrl": "https://project.link/success",
"title": "Название проекта",
"logoLink": "https://project.link/logo.png"
}
{
"merchantId": 1,
"projectId": 1,
"projectCode": "code",
"token": "very_secret_token"
}
{
"merchantId": 1,
"projectId": 1,
"token": "token"
}