> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developer.ordergroove.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developer.ordergroove.com/_mcp/server.

# Purchase POST API

POST https://sc.ordergroove.com/subscription/create
Content-Type: application/json



Reference: https://developer.ordergroove.com/reference/payment-api/payment-requests/purchase-post-api

## Authentication

- `x-api-key` header (required) — API Key authentication via header

## Request

### Body (application/json)

This endpoint expects an object.

- `merchant_id` (string, required) — merchant public id
- `merchant_order_id` (string, required) — Order ID in your system
- `og_cart_tracking` (boolean, optional) — If omitted or true, then session_id is required. Otherwise, session_id is optional.
- `session_id` (string, optional) — Session Id, gotten from og_session_id cookie.
- `user` (SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaUser, optional) — The customer being created; required fields can be updated by contacting support.
- `payment` (SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaPayment, optional) — Required fields can be configured via RC3
- `products` (SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProducts, optional) — The products that this customer bought or subscribed to

## Response

### 200

200

- `result` (string, optional)
- `subs_req_id` (string, optional)

### 206

206

## Errors

### 400 Bad Request Error

400

- `session_id` (string, optional)
- `start_date` (string, optional)
- `user_id` (string, optional)
- `merchant_order_id` (string, optional)
- `customer` (SubscriptionCreatePostResponsesContentApplicationJsonSchemaCustomer, optional)
- `shipping_address` (SubscriptionCreatePostResponsesContentApplicationJsonSchemaShippingAddress, optional)
- `payment` (SubscriptionCreatePostResponsesContentApplicationJsonSchemaPayment, optional)
- `products` (list of SubscriptionCreatePostResponsesContentApplicationJsonSchemaProductsItems, optional)
- `subscriptions` (list of SubscriptionCreatePostResponsesContentApplicationJsonSchemaSubscriptionsItems, optional)

### 403 Forbidden Error

403

- `detail` (string, optional)

## Types

### SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaUser

The customer being created; required fields can be updated by contacting support.

- `user_id` (string, optional) — Merchant User ID
- `first_name` (string, optional)
- `last_name` (string, optional)
- `email` (string, optional)
- `phone_number` (string, optional)
- `extra_data` (SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaUserExtraData, optional)
- `price_code` (string, optional) — An optional value that can be used to apply specific discounting to all subscriptions for the customer
- `shipping_address` (SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaUserShippingAddress, optional)
- `billing_address` (SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaUserBillingAddress, optional)

### SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaPayment

Required fields can be configured via RC3

- `cc_number` (string, optional) — Last 4 digits of CC number - XXXXXXXXXXXXXXXX1234
- `cc_holder` (string, optional) — Encrypted credit card holder
- `cc_exp_date` (string, optional) — Encrypted credit card expiration date (format: MM/YYYY)
- `label` (string, optional)
- `token_id` (string, optional)
- `cc_type` (string, optional) — Card brand code. See [Credit Card Types](/api-reference/credit-card-types).
- `payment_method` (string, optional, default: credit card) — Method of payment - "paypal", "credit card", "applepay", or "googlepay"

### SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProducts

The products that this customer bought or subscribed to

- `product` (string, optional) — Merchant Product ID
- `sku` (string, optional) — product sku
- `subscription_info` (SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProductsSubscriptionInfo, optional)
- `purchase_info` (SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProductsPurchaseInfo, optional)

### SubscriptionCreatePostResponsesContentApplicationJsonSchemaCustomer

- `[field_name]` (string, optional)

### SubscriptionCreatePostResponsesContentApplicationJsonSchemaShippingAddress

- `[field_name]` (string, optional)

### SubscriptionCreatePostResponsesContentApplicationJsonSchemaPayment

- `[field_name]` (string, optional)

### SubscriptionCreatePostResponsesContentApplicationJsonSchemaProductsItems

- `sku` (string, optional)
- `purchase_info` (SubscriptionCreatePostResponsesContentApplicationJsonSchemaProductsItemsPurchaseInfo, optional)

### SubscriptionCreatePostResponsesContentApplicationJsonSchemaSubscriptionsItems

- `subscription` (SubscriptionCreatePostResponsesContentApplicationJsonSchemaSubscriptionsItemsSubscription, optional)

### SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaUserExtraData

- `key1` (string, optional)
- `key2` (string, optional)

### SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaUserShippingAddress

- `first_name` (string, optional)
- `last_name` (string, optional)
- `label` (string, optional) — optional
- `company_name` (string, optional) — optional
- `address` (string, optional)
- `address2` (string, optional) — optional
- `city` (string, optional)
- `state_province_code` (string, optional)
- `zip_postal_code` (string, optional)
- `country_code` (string, optional)
- `phone` (string, optional)
- `fax` (string, optional) — optional
- `token_id` (string, optional) — External merchant reference, optional
- `store_id` (string, optional) — optional

### SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaUserBillingAddress

- `first_name` (string, optional)
- `last_name` (string, optional)
- `label` (string, optional) — optional
- `company_name` (string, optional) — optional
- `address` (string, optional)
- `address2` (string, optional) — optional
- `city` (string, optional)
- `state_province_code` (string, optional)
- `zip_postal_code` (string, optional)
- `country_code` (string, optional)
- `phone` (string, optional)
- `fax` (string, optional) — optional
- `token_id` (string, optional) — optional

### SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProductsSubscriptionInfo

- `price` (string, optional) — Price of subscription. To be used with price lock.
- `quantity` (integer, optional) — Number of items
- `first_order_place_date` (string, optional) — Specify the placement date for the first recurring order of the subscription (format YYYY-MM-DD)
- `initial_order_offset_days` (string, optional) — Offset the first order placement date by x days (only used if first_order_place_date not present)
- `multi_item_bundle_components` (list of SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProductsSubscriptionInfoMultiItemBundleComponentsItems, optional) — Creates a New Bundle Subscription. Bundle items will be created based on provided product ID and quantity. **The subscription product should be a bundle product_type while the products in the array needs to be standard products**
- `components` (list of string, optional) — Creates Legacy Bundles subscription. Strings in this array are product IDs associated with the parent subscription product.
- `tracking_override` (SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProductsSubscriptionInfoTrackingOverride, optional)
- `subscription_type` (enum, optional) — Can be set to 'prepaid' if you are creating a prepaid subscription. Merchant needs to be prepaid enabled to create be able to create it
  - Allowed values: `prepaid`
- `prepaid_orders_per_billing` (integer, optional) — An integer greater than 2. This is the amount of orders that were paid for. It will only be used if subscription_type = 'prepaid'
- `renewal_behavior` (enum, optional) — Custom renewal behavior you want when checking out with a prepaid item. When the prepaid cycle for this subscription ends, this behavior will be followed
  - Allowed values: `autorenew`, `cancel`, `downgrade`
- `rotation_ordinal` (integer, optional) — An integer value greater than or equal to 0 used to determine the current progress of the rotating ordinal subscription.
- `disable_free_trial` (boolean, optional, default: false) — To be used with free trials, disables free trial functionality for the given subscription's product and reverts back to regular subscription creation flow.

### SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProductsPurchaseInfo

- `quantity` (integer, optional) — Number of items the customer checkedout with in the first order
- `price` (string, optional) — Price per unit for the first order (without discounts)
- `discounted_price` (string, optional) — Price after discount in the first order
- `total` (string, optional) — Total discounted price for the product in the first checkout order
- `grantees` (list of SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProductsPurchaseInfoGranteesItems, optional) — Array of grantees, no duplicates allowed.

### SubscriptionCreatePostResponsesContentApplicationJsonSchemaProductsItemsPurchaseInfo

- `[field_name]` (string, optional)

### SubscriptionCreatePostResponsesContentApplicationJsonSchemaSubscriptionsItemsSubscription

- `[field_name]` (string, optional)

### SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProductsSubscriptionInfoMultiItemBundleComponentsItems

- `product` (string, required) — The id of the product that is being added to the bundle
- `quantity` (integer, required, default: 1) — The quantity of the product being added

### SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProductsSubscriptionInfoTrackingOverride

- `product` (string, optional) — Merchant Product ID for which to create the subscription - overrides product that was purchased
- `every` (integer, optional) — Frequency value - overrides tracked values (eg the 30 in 30 Days)
- `every_period` (integer, optional) — Frequency period type - overrides the tracked value: 1 = days, 2 = weeks, 3 = months, 4 = monthly
- `offer` (string, optional) — Incentive Offer ID to which the subscription will be associated with - overrides any tracked value.

### SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProductsPurchaseInfoGranteesItems

- `grantee` (SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProductsPurchaseInfoGranteesItemsGrantee, optional) — Grantee object to be associated with subscription

### SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProductsPurchaseInfoGranteesItemsGrantee

Grantee object to be associated with subscription

- `name` (string, required) — Name of grantee
- `external_id` (string, required) — External ID of grantee

## Examples

### Result

**Request**

```json
{
  "merchant_id": "string",
  "merchant_order_id": "string"
}
```

**Response**

```json
{
  "result": "Subscription request received",
  "subs_req_id": "34900fjkc34i2kdcs"
}
```

**SDK Code**

```python Result
import requests

url = "https://sc.ordergroove.com/subscription/create"

payload = {
    "merchant_id": "string",
    "merchant_order_id": "string"
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Result
const url = 'https://sc.ordergroove.com/subscription/create';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"merchant_id":"string","merchant_order_id":"string"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Result
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://sc.ordergroove.com/subscription/create"

	payload := strings.NewReader("{\n  \"merchant_id\": \"string\",\n  \"merchant_order_id\": \"string\"\n}")

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

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

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

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

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Result
require 'uri'
require 'net/http'

url = URI("https://sc.ordergroove.com/subscription/create")

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

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"merchant_id\": \"string\",\n  \"merchant_order_id\": \"string\"\n}"

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

```java Result
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://sc.ordergroove.com/subscription/create")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"merchant_id\": \"string\",\n  \"merchant_order_id\": \"string\"\n}")
  .asString();
```

```php Result
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://sc.ordergroove.com/subscription/create', [
  'body' => '{
  "merchant_id": "string",
  "merchant_order_id": "string"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Result
using RestSharp;

var client = new RestClient("https://sc.ordergroove.com/subscription/create");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"merchant_id\": \"string\",\n  \"merchant_order_id\": \"string\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Result
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "merchant_id": "string",
  "merchant_order_id": "string"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://sc.ordergroove.com/subscription/create")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Result

**Request**

```json
{
  "merchant_id": "string",
  "merchant_order_id": "string"
}
```

**Response**

```json
{
  "customer": "aab98a89as0989",
  "payment": "f67a4sd564654s",
  "subscriptions": [
    {
      "some_product_id": "68b78786s78d6f"
    }
  ],
  "errors": {
    "products": [
      {
        "sku": [
          "This field is required."
        ]
      }
    ],
    "subscriptions": [
      {
        "product": "faux-product",
        "subscription": {
          "product": [
            "Object with external_product_id=faux-product does not exist."
          ],
          "quantity": [
            "This field is required."
          ]
        }
      }
    ]
  }
}
```

**SDK Code**

```python Result
import requests

url = "https://sc.ordergroove.com/subscription/create"

payload = {
    "merchant_id": "string",
    "merchant_order_id": "string"
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Result
const url = 'https://sc.ordergroove.com/subscription/create';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"merchant_id":"string","merchant_order_id":"string"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Result
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://sc.ordergroove.com/subscription/create"

	payload := strings.NewReader("{\n  \"merchant_id\": \"string\",\n  \"merchant_order_id\": \"string\"\n}")

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

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

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

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

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Result
require 'uri'
require 'net/http'

url = URI("https://sc.ordergroove.com/subscription/create")

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

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"merchant_id\": \"string\",\n  \"merchant_order_id\": \"string\"\n}"

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

```java Result
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://sc.ordergroove.com/subscription/create")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"merchant_id\": \"string\",\n  \"merchant_order_id\": \"string\"\n}")
  .asString();
```

```php Result
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://sc.ordergroove.com/subscription/create', [
  'body' => '{
  "merchant_id": "string",
  "merchant_order_id": "string"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Result
using RestSharp;

var client = new RestClient("https://sc.ordergroove.com/subscription/create");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"merchant_id\": \"string\",\n  \"merchant_order_id\": \"string\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Result
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "merchant_id": "string",
  "merchant_order_id": "string"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://sc.ordergroove.com/subscription/create")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```