Payment Methods
Card PaymentPost
https://sandbox-api.srpago.com/v1/payment/card
Send card payment request
headers
AuthorizationBasic
Content-Typeapplication/json
Parameters
Key*<String> RSA key used un encrypt the data
data**<String> Message encrypted with AES 256
Metadata (optional)<Metadata object> Add metadata to fraude prevention rules
body
{"key":"","data":"","metadata":{}}
Objeto de Cargo
recurrent (Required)<String> Sr. Pago’s token
payment::external::transaction (Required)<String> transaction ID
payment::external::application_key (Optional)<String>Application key
payment::total::amount (Required)<Double> Amount
payment::total::currency(Required)<String> MXN
payment::tip::amount (Optional)<Double> Tip Amount
payment::reference::number (Required)<String> Reference number
payment::reference::description (Required)<String> Transfer description
payment::affiliated::user (Optional)<String> Connect/join module user
payment::affiliated::total_fee(Optional)<String> Total amount for connect/join user
Example Request
curl -X POST \ https://sandbox-api.srpago.com/v1/payment/card \ -H 'Content-Type: application/json' \ -H 'Authorization: Basic ' \ -H 'cache-control: no-cache' \ -d '{"key":"","data":"","metadata":{}}'
var settings = { "async": true, "crossDomain": true, "url": "https://sandbox-api.srpago.com/v1/payment/card", "method": "POST", "headers": { "Content-Type": "application/json", "Authorization": "Basic " }, "data": "{\"key\":\"\",\"data\":\"\",\"metadata\":{}}" } $.ajax(settings).done(function (response) { console.log(response); });
require 'uri' require 'net/http' url = URI("https://sandbox-api.srpago.com/v1/payment/card") http = Net::HTTP.new(url.host, url.port) request = Net::HTTP::Post.new(url) request["Content-Type"] = 'application/json' request["Authorization"] = 'Basic ' request.body = "{\"key\":\"\",\"data\":\"\",\"metadata\":{}}" response = http.request(request) puts response.read_body
import requests url = "https://sandbox-api.srpago.com/v1/payment/card" payload = "{\"key\":\"\",\"data\":\"\",\"metadata\":{}}" headers = { 'Content-Type': "application/json", 'Authorization': "Basic " } response = requests.request("POST", url, data=payload, headers=headers) print(response.text)
var http = require("https"); var options = { "method": "POST", "hostname": [ "sandbox-api", "srpago", "com" ], "path": [ "v1", "payment", "card" ], "headers": { "Content-Type": "application/json", "Authorization": "Basic " } }; var req = http.request(options, function (res) { var chunks = []; res.on("data", function (chunk) { chunks.push(chunk); }); res.on("end", function () { var body = Buffer.concat(chunks); console.log(body.toString()); }); }); req.write("{\"key\":\"\",\"data\":\"\",\"metadata\":{}}"); req.end();
<?php $request = new HttpRequest(); $request->setUrl('https://sandbox-api.srpago.com/v1/payment/card'); $request->setMethod(HTTP_METH_POST); $request->setHeaders(array( 'Authorization' => 'Basic ', 'Content-Type' => 'application/json' )); $request->setBody('{"key":"","data":"","metadata":{}}'); try { $response = $request->send(); echo $response->getBody(); } catch (HttpException $ex) { echo $ex; }
Example Response
{ "success": true, "result": { "total": 842, "sales": "707305.04", "transferences": "401.49", "commissions": { "amount": 162.54, "currency": "MXN" }, "operations": [ { "transaction": "MjY2MzYyNQ==", "timestamp": "2018-10-25T12:48:37-05:00", "payment_method": "OXX", "authorization_code": "4174B14B", "status": "N", "reference": { "description": "-" }, "card": { "holder_name": "Banco pruebas", "type": "OXXO", "number": "0000", "label": "", "raw": "0000" }, "total": { "amount": "100.00", "currency": "MXN" }, "tip": { "amount": "0.00", "currency": "MXN" }, "fee": { "amount": "54.18", "currency": "MXN" }, "fee_details": [ { "type": "fee", "percentage": 3.6, "amount": 4.18, "description": "" }, { "type": "application_fee", "percentage": 20, "amount": 20, "description": "CONTRACARGO DE 50mil" }, { "type": "application_fee", "percentage": 30, "amount": 30, "description": "FINANCIAMIENTO 2" } ], "origin": { "location": { "latitude": "0.000000", "longitude": "0.000000" } }, "affiliation": "0", "url": "https://sandbox-connect.srpago.com/recipe/OTUzYjg4MmUtYzYyNS00YTEzLTg3NjQtOGRmZWY3N", "hasDevolution": false, "commission": { "amount": "54.18", "currency": "MXN" } }, { "transaction": "MjY2MzYyNA==", "timestamp": "2018-10-25T12:32:15-05:00", "payment_method": "OXX", "authorization_code": "417478AD", "status": "N", "reference": { "description": "-" }, "card": { "holder_name": "Banco pruebas", "type": "OXXO", "number": "0000", "label": "", "raw": "0000" }, "total": { "amount": "100.00", "currency": "MXN" }, "tip": { "amount": "0.00", "currency": "MXN" }, "fee": { "amount": "54.18", "currency": "MXN" }, "fee_details": [ { "type": "fee", "percentage": 3.6, "amount": 4.18, "description": "" }, { "type": "application_fee", "percentage": 20, "amount": 20, "description": "CONTRACARGO DE 50mil" }, { "type": "application_fee", "percentage": 30, "amount": 30, "description": "FINANCIAMIENTO 2" } ], "origin": { "location": { "latitude": "0.000000", "longitude": "0.000000" } }, "affiliation": "0", "url": "https://sandbox-connect.srpago.com/recipe/ZDE4MTY3MDgtZjgxOC00ZmY1LTlkOGUtYTI1MDcwZGZhZjVl", "hasDevolution": false, "commission": { "amount": "54.18", "currency": "MXN" } } ] } }