Skip to main content
POST
/
ext-stripe
/
payment-method
Create payment method
curl --request POST \
  --url https://prod01-apigw.{customer_name}.fabric.zone/ext-stripe/payment-method \
  --header 'Content-Type: application/json' \
  --data '
{
  "type": "card",
  "metadata": {
    "keyName": "key value"
  },
  "billing_details": {
    "name": "John Smith",
    "email": "john@fabric.inc",
    "phone": "123-456-7890"
  }
}
'
import requests

url = "https://prod01-apigw.{customer_name}.fabric.zone/ext-stripe/payment-method"

payload = {
    "type": "card",
    "metadata": { "keyName": "key value" },
    "billing_details": {
        "name": "John Smith",
        "email": "john@fabric.inc",
        "phone": "123-456-7890"
    }
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    type: 'card',
    metadata: {keyName: 'key value'},
    billing_details: {name: 'John Smith', email: 'john@fabric.inc', phone: '123-456-7890'}
  })
};

fetch('https://prod01-apigw.{customer_name}.fabric.zone/ext-stripe/payment-method', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://prod01-apigw.{customer_name}.fabric.zone/ext-stripe/payment-method",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'type' => 'card',
    'metadata' => [
        'keyName' => 'key value'
    ],
    'billing_details' => [
        'name' => 'John Smith',
        'email' => 'john@fabric.inc',
        'phone' => '123-456-7890'
    ]
  ]),
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json"
  ],
]);

$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"
	"net/http"
	"io"
)

func main() {

	url := "https://prod01-apigw.{customer_name}.fabric.zone/ext-stripe/payment-method"

	payload := strings.NewReader("{\n  \"type\": \"card\",\n  \"metadata\": {\n    \"keyName\": \"key value\"\n  },\n  \"billing_details\": {\n    \"name\": \"John Smith\",\n    \"email\": \"john@fabric.inc\",\n    \"phone\": \"123-456-7890\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://prod01-apigw.{customer_name}.fabric.zone/ext-stripe/payment-method")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"card\",\n  \"metadata\": {\n    \"keyName\": \"key value\"\n  },\n  \"billing_details\": {\n    \"name\": \"John Smith\",\n    \"email\": \"john@fabric.inc\",\n    \"phone\": \"123-456-7890\"\n  }\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://prod01-apigw.{customer_name}.fabric.zone/ext-stripe/payment-method")

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

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"type\": \"card\",\n  \"metadata\": {\n    \"keyName\": \"key value\"\n  },\n  \"billing_details\": {\n    \"name\": \"John Smith\",\n    \"email\": \"john@fabric.inc\",\n    \"phone\": \"123-456-7890\"\n  }\n}"

response = http.request(request)
puts response.read_body
{
  "id": "pm_1Ij5zBJxr7zyIFb9u3cfbHJG",
  "object": "payment_method",
  "card": {
    "brand": "visa",
    "checks": {
      "address_line1_check": "unchecked",
      "address_postal_code_check": "unchecked",
      "cvc_check": "unchecked"
    },
    "country": "US",
    "exp_month": 2,
    "exp_year": 2023,
    "fingerprint": "lf55OlXOOfjcvjan",
    "funding": "credit",
    "generated_from": null,
    "last4": "4242",
    "networks": {
      "available": [
        "visa"
      ],
      "preferred": null
    },
    "three_d_secure_usage": {
      "supported": true
    },
    "wallet": null
  },
  "created": 1619111201,
  "customer": null,
  "livemode": false,
  "metadata": {},
  "type": "card",
  "billing_details": {
    "address": {
      "line1": "3520 Millenio",
      "city": "Vancouver",
      "state": "BC",
      "country": "CA",
      "postal_code": "V5R 6G9",
      "line2": "Crowley Drive"
    },
    "name": "John Smith",
    "email": "john@fabric.inc",
    "phone": "123-456-7890"
  }
}
{
  "code": "<string>",
  "message": "<string>"
}
{
  "message": "Forbidden"
}
{
  "code": "<string>",
  "message": "<string>"
}

Headers

x-api-key
string
Example:

"0LybWR49k95cCwYh3cu0waCYoh4H2Eux2J52wn4k"

Body

application/json
type
enum<string>
default:card
Available options:
au_becs_debit,
bacs_debit,
bancontact,
card,
eps,
fpx,
giropay,
ideal,
p24,
sepa_debit
Example:

"card"

metadata
object
Example:
{ "keyName": "key value" }
card
object
billing_details
object

Response

Created payment method

id
string
Example:

"pm_1Ij5zBJxr7zyIFb9u3cfbHJG"

object
string
Example:

"payment_method"

card
object
created
number
Example:

1619111201

customer
string
Example:

null

livemode
boolean
Example:

false

metadata
object
type
string
Example:

"card"

billing_details
object