Customer

Customer UpdatePut

https://sandbox-api.srpago.com/v1/customer/cus_58de85516182c
Update account info

headers

AuthorizationBasic

Content-Typeapplication/json

body

{
  "email":"[email protected]",
  "name":"customer full name ", 
  "metadata":
    {
      "key":"value",
      "key2":"value2"
    }
}

 


Example Request

  curl --location --request PUT "https://sandbox-api.srpago.com/v1/customer/cus_58de85516182c" \
  --header "Content-Type: application/json" \
  --header "Authorization: Basic" \
  --data "{
	\"email\":\"[email protected]\",
	\"name\":\"customer full name \", 
	\"metadata\":
		{
			\"key\":\"value\",
			\"key2\":\"value2\"
		}
}"
var settings = {
  "url": "https://sandbox-api.srpago.com/v1/customer/cus_58de85516182c",
  "method": "PUT",
  "timeout": 0,
  "headers": {
    "Content-Type": "application/json",
    "Authorization": "Basic"
  },
  "data": "{\n\t\"email\":\"[email protected]\",\n\t\"name\":\"customer full name \", \n\t\"metadata\":\n\t\t{\n\t\t\t\"key\":\"value\",\n\t\t\t\"key2\":\"value2\"\n\t\t}\n}",
};
$.ajax(settings).done(function (response) {
  console.log(response);
});
require "uri"
require "net/http"

url = URI("https://sandbox-api.srpago.com/v1/customer/cus_58de85516182c")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Put.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Basic"
request.body = "{\n\t\"email\":\"[email protected]\",\n\t\"name\":\"customer full name \", \n\t\"metadata\":\n\t\t{\n\t\t\t\"key\":\"value\",\n\t\t\t\"key2\":\"value2\"\n\t\t}\n}"

response = http.request(request)
puts response.read_body

import requests
url = 'https://sandbox-api.srpago.com/v1/customer/cus_58de85516182c'
payload = "{\n\t\"email\":\"[email protected]\",\n\t\"name\":\"customer full name \", \n\t\"metadata\":\n\t\t{\n\t\t\t\"key\":\"value\",\n\t\t\t\"key2\":\"value2\"\n\t\t}\n}"
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic'
}
response = requests.request('PUT', url, headers = headers, data = payload, allow_redirects=False, timeout=undefined, allow_redirects=false)
print(response.text)
var https = require('https');

var options = {
  'method': 'PUT',
  'hostname': 'https://sandbox-api.srpago.com',
  'path': '/v1/customer/cus_58de85516182c',
  '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\"email\":\"[email protected]\",\n\t\"name\":\"customer full name \", \n\t\"metadata\":\n\t\t{\n\t\t\t\"key\":\"value\",\n\t\t\t\"key2\":\"value2\"\n\t\t}\n}";

req.write(postData);

req.end();
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://sandbox-api.srpago.com/v1/customer/cus_58de85516182c",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => false,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS =>"{\n\t\"email\":\"[email protected]\",\n\t\"name\":\"customer full name \", \n\t\"metadata\":\n\t\t{\n\t\t\t\"key\":\"value\",\n\t\t\t\"key2\":\"value2\"\n\t\t}\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/customer/cus_58de85516182c"
  method := "PUT"

  payload := strings.NewReader("{\n	\"email\":\"[email protected]\",\n	\"name\":\"customer full name \", \n	\"metadata\":\n		{\n			\"key\":\"value\",\n			\"key2\":\"value2\"\n		}\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))
}