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

# Purchase POST API

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



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

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: ordergroove-payment-api
  version: 1.0.0
paths:
  /subscription/create:
    post:
      operationId: purchase-post-api
      summary: Purchase POST API
      description: ''
      tags:
        - paymentRequests
      parameters:
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
      responses:
        '200':
          description: '200'
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/Payment
                  Requests_purchase-post-api_Response_200
        '400':
          description: '400'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Purchase-post-apiRequestBadRequestError'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                merchant_id:
                  type: string
                  description: merchant public id
                og_cart_tracking:
                  type: boolean
                  description: >-
                    If omitted or true, then session_id is required. Otherwise,
                    session_id is optional.
                session_id:
                  type: string
                  description: Session Id, gotten from og_session_id cookie.
                merchant_order_id:
                  type: string
                  description: Order ID in your system
                user:
                  $ref: >-
                    #/components/schemas/SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaUser
                  description: >-
                    The customer being created; required fields can be updated
                    by contacting support.
                payment:
                  $ref: >-
                    #/components/schemas/SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaPayment
                  description: Required fields can be configured via RC3
                products:
                  $ref: >-
                    #/components/schemas/SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProducts
                  description: The products that this customer bought or subscribed to
              required:
                - merchant_id
                - merchant_order_id
servers:
  - url: https://sc.ordergroove.com
    description: https://sc.ordergroove.com
components:
  schemas:
    SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaUserExtraData:
      type: object
      properties:
        key1:
          type: string
        key2:
          type: string
      title: >-
        SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaUserExtraData
    SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaUserShippingAddress:
      type: object
      properties:
        first_name:
          type: string
        last_name:
          type: string
        label:
          type: string
          description: optional
        company_name:
          type: string
          description: optional
        address:
          type: string
        address2:
          type: string
          description: optional
        city:
          type: string
        state_province_code:
          type: string
        zip_postal_code:
          type: string
        country_code:
          type: string
        phone:
          type: string
        fax:
          type: string
          description: optional
        token_id:
          type: string
          description: External merchant reference, optional
        store_id:
          type: string
          description: optional
      title: >-
        SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaUserShippingAddress
    SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaUserBillingAddress:
      type: object
      properties:
        first_name:
          type: string
        last_name:
          type: string
        label:
          type: string
          description: optional
        company_name:
          type: string
          description: optional
        address:
          type: string
        address2:
          type: string
          description: optional
        city:
          type: string
        state_province_code:
          type: string
        zip_postal_code:
          type: string
        country_code:
          type: string
        phone:
          type: string
        fax:
          type: string
          description: optional
        token_id:
          type: string
          description: optional
      title: >-
        SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaUserBillingAddress
    SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaUser:
      type: object
      properties:
        user_id:
          type: string
          description: Merchant User ID
        first_name:
          type: string
        last_name:
          type: string
        email:
          type: string
        phone_number:
          type: string
        extra_data:
          $ref: >-
            #/components/schemas/SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaUserExtraData
        price_code:
          type: string
          description: >-
            An optional value that can be used to apply specific discounting to
            all subscriptions for the customer
        shipping_address:
          $ref: >-
            #/components/schemas/SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaUserShippingAddress
        billing_address:
          $ref: >-
            #/components/schemas/SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaUserBillingAddress
      description: >-
        The customer being created; required fields can be updated by contacting
        support.
      title: SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaUser
    SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaPayment:
      type: object
      properties:
        cc_number:
          type: string
          description: Last 4 digits of CC number - XXXXXXXXXXXXXXXX1234
        cc_holder:
          type: string
          description: Encrypted credit card holder
        cc_exp_date:
          type: string
          description: 'Encrypted credit card expiration date (format: MM/YYYY)'
        label:
          type: string
        token_id:
          type: string
        cc_type:
          type: string
          description: 'See Card Types in #credit-card-types'
        payment_method:
          type: string
          default: credit card
          description: >-
            Method of payment - "paypal", "credit card", "applepay", or
            "googlepay"
      description: Required fields can be configured via RC3
      title: SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaPayment
    SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProductsSubscriptionInfoMultiItemBundleComponentsItems:
      type: object
      properties:
        product:
          type: string
          description: The id of the product that is being added to the bundle
        quantity:
          type: integer
          default: 1
          description: The quantity of the product being added
      required:
        - product
        - quantity
      title: >-
        SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProductsSubscriptionInfoMultiItemBundleComponentsItems
    SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProductsSubscriptionInfoTrackingOverride:
      type: object
      properties:
        product:
          type: string
          description: >-
            Merchant Product ID for which to create the subscription - overrides
            product that was purchased
        every:
          type: integer
          description: Frequency value - overrides tracked values (eg the 30 in 30 Days)
        every_period:
          type: integer
          description: >-
            Frequency period type - overrides the tracked value: 1 = days, 2 =
            weeks, 3 = months, 4 = monthly
        offer:
          type: string
          description: >-
            Incentive Offer ID to which the subscription will be associated with
            - overrides any tracked value.
      title: >-
        SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProductsSubscriptionInfoTrackingOverride
    SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProductsSubscriptionInfoSubscriptionType:
      type: string
      enum:
        - prepaid
      description: >-
        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
      title: >-
        SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProductsSubscriptionInfoSubscriptionType
    SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProductsSubscriptionInfoRenewalBehavior:
      type: string
      enum:
        - autorenew
        - cancel
        - downgrade
      description: >-
        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
      title: >-
        SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProductsSubscriptionInfoRenewalBehavior
    SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProductsSubscriptionInfo:
      type: object
      properties:
        price:
          type: string
          description: Price of subscription. To be used with price lock.
        quantity:
          type: integer
          description: Number of items
        first_order_place_date:
          type: string
          description: >-
            Specify the placement date for the first recurring order of the
            subscription (format YYYY-MM-DD)
        initial_order_offset_days:
          type: string
          description: >-
            Offset the first order placement date by x days (only used if
            first_order_place_date not present)
        multi_item_bundle_components:
          type: array
          items:
            $ref: >-
              #/components/schemas/SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProductsSubscriptionInfoMultiItemBundleComponentsItems
          description: >-
            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:
          type: array
          items:
            type: string
          description: >-
            Creates Legacy Bundles subscription. Strings in this array are
            product IDs associated with the parent subscription product.
        tracking_override:
          $ref: >-
            #/components/schemas/SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProductsSubscriptionInfoTrackingOverride
        subscription_type:
          $ref: >-
            #/components/schemas/SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProductsSubscriptionInfoSubscriptionType
          description: >-
            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
        prepaid_orders_per_billing:
          type: integer
          description: >-
            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:
          $ref: >-
            #/components/schemas/SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProductsSubscriptionInfoRenewalBehavior
          description: >-
            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
        rotation_ordinal:
          type: integer
          description: >-
            An integer value greater than or equal to 0 used to determine the
            current progress of the rotating ordinal subscription.
      title: >-
        SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProductsSubscriptionInfo
    SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProductsPurchaseInfo:
      type: object
      properties:
        quantity:
          type: integer
          description: Number of items the customer checkedout with in the first order
        price:
          type: string
          description: Price per unit for the first order (without discounts)
        discounted_price:
          type: string
          description: Price after discount in the first order
        total:
          type: string
          description: Total discounted price for the product in the first checkout order
      title: >-
        SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProductsPurchaseInfo
    SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProducts:
      type: object
      properties:
        product:
          type: string
          description: Merchant Product ID
        sku:
          type: string
          description: product sku
        subscription_info:
          $ref: >-
            #/components/schemas/SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProductsSubscriptionInfo
        purchase_info:
          $ref: >-
            #/components/schemas/SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProductsPurchaseInfo
      description: The products that this customer bought or subscribed to
      title: SubscriptionCreatePostRequestBodyContentApplicationJsonSchemaProducts
    Payment Requests_purchase-post-api_Response_200:
      type: object
      properties:
        result:
          type: string
        subs_req_id:
          type: string
      title: Payment Requests_purchase-post-api_Response_200
    SubscriptionCreatePostResponsesContentApplicationJsonSchemaCustomer:
      type: object
      properties:
        '[field_name]':
          type: string
      title: SubscriptionCreatePostResponsesContentApplicationJsonSchemaCustomer
    SubscriptionCreatePostResponsesContentApplicationJsonSchemaShippingAddress:
      type: object
      properties:
        '[field_name]':
          type: string
      title: >-
        SubscriptionCreatePostResponsesContentApplicationJsonSchemaShippingAddress
    SubscriptionCreatePostResponsesContentApplicationJsonSchemaPayment:
      type: object
      properties:
        '[field_name]':
          type: string
      title: SubscriptionCreatePostResponsesContentApplicationJsonSchemaPayment
    SubscriptionCreatePostResponsesContentApplicationJsonSchemaProductsItemsPurchaseInfo:
      type: object
      properties:
        '[field_name]':
          type: string
      title: >-
        SubscriptionCreatePostResponsesContentApplicationJsonSchemaProductsItemsPurchaseInfo
    SubscriptionCreatePostResponsesContentApplicationJsonSchemaProductsItems:
      type: object
      properties:
        sku:
          type: string
        purchase_info:
          $ref: >-
            #/components/schemas/SubscriptionCreatePostResponsesContentApplicationJsonSchemaProductsItemsPurchaseInfo
      title: SubscriptionCreatePostResponsesContentApplicationJsonSchemaProductsItems
    SubscriptionCreatePostResponsesContentApplicationJsonSchemaSubscriptionsItemsSubscription:
      type: object
      properties:
        '[field_name]':
          type: string
      title: >-
        SubscriptionCreatePostResponsesContentApplicationJsonSchemaSubscriptionsItemsSubscription
    SubscriptionCreatePostResponsesContentApplicationJsonSchemaSubscriptionsItems:
      type: object
      properties:
        subscription:
          $ref: >-
            #/components/schemas/SubscriptionCreatePostResponsesContentApplicationJsonSchemaSubscriptionsItemsSubscription
      title: >-
        SubscriptionCreatePostResponsesContentApplicationJsonSchemaSubscriptionsItems
    Purchase-post-apiRequestBadRequestError:
      type: object
      properties:
        session_id:
          type: string
        start_date:
          type: string
        user_id:
          type: string
        merchant_order_id:
          type: string
        customer:
          $ref: >-
            #/components/schemas/SubscriptionCreatePostResponsesContentApplicationJsonSchemaCustomer
        shipping_address:
          $ref: >-
            #/components/schemas/SubscriptionCreatePostResponsesContentApplicationJsonSchemaShippingAddress
        payment:
          $ref: >-
            #/components/schemas/SubscriptionCreatePostResponsesContentApplicationJsonSchemaPayment
        products:
          type: array
          items:
            $ref: >-
              #/components/schemas/SubscriptionCreatePostResponsesContentApplicationJsonSchemaProductsItems
        subscriptions:
          type: array
          items:
            $ref: >-
              #/components/schemas/SubscriptionCreatePostResponsesContentApplicationJsonSchemaSubscriptionsItems
      title: Purchase-post-apiRequestBadRequestError
  securitySchemes:
    x-api-key:
      type: apiKey
      in: header
      name: x-api-key

```

## Examples

### Result



**Request**

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

**Response**

```json
{}
```

**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
"{\n  \"customer\": \"aab98a89as0989\",\n  \"payment\": \"f67a4sd564654s\",\n  \"subscriptions\": [{\n    \"some_product_id\": \"68b78786s78d6f\",\n  }],\n  \"errors\": {\n    \"products\": [{\n      \"sku is a required\"\n    }],\n    \"subscriptions\": [{\n      \"product\": \"faux-product\",\n      \"subscription\": {\n        \"product\": [\"Object with external_product_id=faux-product does not exist.\"],\n        \"quantity\": [\"This field is required.\"]\n      }\n    }\n  ]\n}"
```

**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()
```