Create Product

payments/create-product@1.0.0
Supported by 2 providers
P
S

Create Product

Creates a product in a payment system.

Input
Name
Description
Product type
Result
ID

1.Choose a provider

2.Use CreateProduct with mock in your code

npm i @superfaceai/one-sdk
const { SuperfaceClient } = require('@superfaceai/one-sdk');

const sdk = new SuperfaceClient();

async function run() {
  // Load the profile
  const profile = await sdk.getProfile('payments/create-product@1.0.0');

  // Use the profile
  const result = await profile
    .getUseCase('CreateProduct')
    .perform({
      name: 'Superface milk',
      description: 'Milk that gives you super-powers, delivered to your door.'
    }, {
      provider: 'mock'
    });

  // Handle the result
  try {
    const data = result.unwrap();
    console.log(data);
  } catch (error) {
    console.error(error);
  }
}

run();

Structure details

Input (object)

name
Name of the product to be created.
description
Description of the product to be created.
type
Indicates whether the product is physical or intangible (e.g. a service, or digital goods). Possible values: - `physical` - `digital` - `service`

Example

{
  "name": "Superface milk",
  "description": "Milk that gives you super-powers, delivered to your door."
}

Result (object)

productId
Unique identifier of the product.

Example

{
  "productId": "PROD-1192810198"
}

Implementation details

Provider
mock
Use case
CreateProduct
Author
@superface
Source
Verified