Skip to main content
POST
/
v1
/
payment_links
Create Payment Link
curl --request POST \
  --url https://api.withflex.com/v1/payment_links \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "payment_link": {
    "line_items": [
      {}
    ],
    "label": "Example",
    "shipping_address_collection": false,
    "shipping_options": {
      "shipping_rate_id": "obj_01EXAMPLE00000000000000000"
    },
    "metadata": {},
    "payment_intent_data": {
      "metadata": {}
    },
    "after_completion": {},
    "allow_promotion_codes": false,
    "origin": "shopify",
    "tax_rate": {
      "amount": 0
    },
    "discounts": [],
    "mode": "payment"
  }
}
'
{
  "payment_link": {
    "payment_link_id": "obj_01EXAMPLE00000000000000000",
    "label": "Example",
    "active": false,
    "line_items": [
      {}
    ],
    "allow_promotion_codes": false,
    "shipping_address_collection": false,
    "shipping_options": {
      "shipping_rate_id": "obj_01EXAMPLE00000000000000000",
      "shipping_amount": 0,
      "display_name": "Example"
    },
    "metadata": {},
    "url": "https://example.com",
    "created_at": "2024-01-01T00:00:00Z",
    "payment_intent_data": {
      "metadata": {}
    },
    "after_completion": {},
    "origin": "shopify",
    "tax_rate": {
      "amount": 0
    },
    "discounts": [
      "string"
    ],
    "test_mode": false
  }
}

Authorizations

Authorization
string
header
required

Use a Bearer token to access this API.

Body

application/json
Example:
{
  "line_items": [
    {
      "price": "string",
      "quantity": 0,
      "shipping_options": {},
      "tax_rate": {}
    }
  ],
  "label": "Example",
  "shipping_address_collection": false,
  "shipping_options": {
    "shipping_rate_id": "obj_01EXAMPLE00000000000000000",
    "shipping_rate_data": {
      "display_name": "Example",
      "amount": 0,
      "metadata": {}
    }
  },
  "metadata": {},
  "payment_intent_data": {
    "capture_method": "automatic",
    "metadata": {}
  },
  "after_completion": {
    "type": "redirect",
    "hosted_confirmation": { "custom_message": "string" },
    "redirect": { "url": "https://example.com" }
  },
  "allow_promotion_codes": false,
  "origin": "shopify",
  "tax_rate": { "amount": 0 },
  "discounts": [{ "coupon_id": "string" }],
  "mode": "payment"
}

Response

Success

Example:
{
  "payment_link_id": "obj_01EXAMPLE00000000000000000",
  "label": "Example",
  "active": false,
  "line_items": [
    {
      "price": "string",
      "quantity": 0,
      "shipping_options": {},
      "tax_rate": {}
    }
  ],
  "allow_promotion_codes": false,
  "shipping_address_collection": false,
  "shipping_options": {
    "shipping_rate_id": "obj_01EXAMPLE00000000000000000",
    "shipping_amount": 0,
    "display_name": "Example"
  },
  "metadata": {},
  "url": "https://example.com",
  "created_at": "2024-01-01T00:00:00Z",
  "payment_intent_data": {
    "capture_method": "automatic",
    "metadata": {}
  },
  "after_completion": {
    "type": "redirect",
    "hosted_confirmation": { "custom_message": "string" },
    "redirect": { "url": "https://example.com" }
  },
  "origin": "shopify",
  "tax_rate": { "amount": 0 },
  "discounts": ["string"],
  "test_mode": false
}