Skip to content

Instantly share code, notes, and snippets.

@chanakaDe
Last active May 5, 2020 15:51
Show Gist options
  • Save chanakaDe/148b99922c9b0750912bbb15266deb01 to your computer and use it in GitHub Desktop.
Save chanakaDe/148b99922c9b0750912bbb15266deb01 to your computer and use it in GitHub Desktop.
"items" need to be an array and when you send in the POSt request, need to make it stringify. Call me if you get any issues.
{
"token": "tok_mastercard",
"user_email": "[email protected]",
"full_name": "Chanaka De Silva",
"order_note":"test description",
"items": {{string_items}},
"shipping": {
"line1": "No 5B, Polwatta Road",
"line2": "Gurugoda",
"city": "Horana",
"state": "Western",
"postal_code": "12400",
"country": "SL"
},
"billing": {
"line1": "No 5B, Polwatta Road",
"line2": "Gurugoda",
"city": "Horana",
"state": "Western",
"postal_code": "12400",
"country": "SL"
}
}
## This is a JS code to make the item array 'stringify'. You need to send exact object.
let item_array = [
{
type: 'sku',
parent: 'sku_GXFKpYsKt9nHYZ',
quantity: 1,
},
{
type: 'sku',
parent: 'sku_GXFIWLDnYkVGWu',
quantity: 2,
}
];
pm.variables.set('string_items', JSON.stringify(item_array));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment