Payment Methods
ConvenienceStorePost
https://sandbox-api.srpago.com/v1/payment/convenience-store
Crea referencias para pagos en efectivo en tiendas Oxxo.
El valor que se ingrese en la propiedad email será utilizado para enviar un correo electrónico con la boleta de pago. Este campo es opcional para pagos OXXO.
headers
AuthorizationBasic
Content-Typeapplication/json
body
{ "payment":{ "reference":{ "description":"-" } }, "expiration_date": "2022-10-11", "email":"[email protected]", "total":100, "store":"oxxo" }
storeOXXO,
Example Request
curl --location --request POST "https://sandbox-api.srpago.com/v1/payment/convenience-store" \ --header "Content-Type: application/json" \ --header "Authorization: Basic " \ --data "{ \"payment\":{ \"reference\":{ \"description\":\"-\" } }, \"total\":100, \"store\":\"oxxo\" }"
var settings = { "url": "https://sandbox-api.srpago.com/v1/payment/convenience-store", "method": "POST", "timeout": 0, "headers": { "Content-Type": "application/json", "Authorization": "Basic " }, "data": "{\n\t\"payment\":{\n\t\t\"reference\":{\n\t\t\t\"description\":\"-\"\n\t\t}\n\t},\n\t\"total\":100,\n\t\"store\":\"oxxo\"\n}", }; $.ajax(settings).done(function (response) { console.log(response); });
require "uri" require "net/http" url = URI("https://sandbox-api.srpago.com/v1/payment/convenience-store") http = Net::HTTP.new(url.host, url.port) request = Net::HTTP::Post.new(url) request["Content-Type"] = "application/json" request["Authorization"] = "Basic " request.body = "{\n\t\"payment\":{\n\t\t\"reference\":{\n\t\t\t\"description\":\"-\"\n\t\t}\n\t},\n\t\"total\":100,\n\t\"store\":\"oxxo\"\n}" response = http.request(request) puts response.read_body
import requests url = 'https://sandbox-api.srpago.com/v1/payment/convenience-store' payload = "{\n\t\"payment\":{\n\t\t\"reference\":{\n\t\t\t\"description\":\"-\"\n\t\t}\n\t},\n\t\"total\":100,\n\t\"store\":\"oxxo\"\n}" headers = { 'Content-Type': 'application/json', 'Authorization': 'Basic ' } response = requests.request('POST', url, headers = headers, data = payload, allow_redirects=False, timeout=undefined, allow_redirects=false) print(response.text)
var https = require('https'); var options = { 'method': 'POST', 'hostname': 'https://sandbox-api.srpago.com', 'path': '/v1/payment/convenience-store', 'headers': { 'Content-Type': 'application/json', 'Authorization': 'Basic ' } }; var req = https.request(options, function (res) { var chunks = []; res.on("data", function (chunk) { chunks.push(chunk); }); res.on("end", function (chunk) { var body = Buffer.concat(chunks); console.log(body.toString()); }); res.on("error", function (error) { console.error(error); }); }); var postData = "{\n\t\"payment\":{\n\t\t\"reference\":{\n\t\t\t\"description\":\"-\"\n\t\t}\n\t},\n\t\"total\":100,\n\t\"store\":\"oxxo\"\n}"; req.write(postData); req.end();
<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://sandbox-api.srpago.com/v1/payment/convenience-store", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => false, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS =>"{\n\t\"payment\":{\n\t\t\"reference\":{\n\t\t\t\"description\":\"-\"\n\t\t}\n\t},\n\t\"total\":100,\n\t\"store\":\"oxxo\"\n}", CURLOPT_HTTPHEADER => array( "Content-Type: application/json", "Authorization: Basic " ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } ?>
package main import ( "fmt" "strings" "os" "path/filepath" "net/http" "io/ioutil" ) func main() { url := "https://sandbox-api.srpago.com/v1/payment/convenience-store" method := "POST" payload := strings.NewReader("{\n \"payment\":{\n \"reference\":{\n \"description\":\"-\"\n }\n },\n \"total\":100,\n \"store\":\"oxxo\"\n}") client := &http.Client { CheckRedirect: func(req *http.Request, via []*http.Request) error { return http.ErrUseLastResponse }, } req, err := http.NewRequest(method, url, payload) if err != nil { fmt.Println(err) } req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", "Basic ") res, err := client.Do(req) defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) fmt.Println(string(body)) }
Example Response
{ "success": true, "result": { "transaction": "5587b8ad-e1e8-4cc7-b6de-9fef5303b4b9", "store": { "name": "OXXO", "short_name": "OXXO" }, "bank_account_number": "0000 0000 0000 0000", "bank_name": "Banco pruebas", "payment_id": "ch_c60aa54b-6d51-48ae-ac5a-7c6895f63bbb", "short_id": "4174B14B", "reference": { "description": "-" }, "total": { "amount": "100.00", "currency": "MXN" }, "url": "https://sandbox-connect.srpago.com/voucher/Y2hfYzYwYWE1NGItNmQ1MS00OGFlLWFjNWEtN2M", "timestamp": "2017-10-25T12:47:27-05:00", "expiration_date": "2017-10-27T23:00:00-05:00", "status": 2, "status_code": "pending" } }