Update a store product mapping

Replaces a mapping's configuration, such as its offers.

The last update wins.

Guide: Map store products

PATCH
/api/v1/projects/{projectId}/payment-providers/{paymentProviderId}/products/{mappingId}

Authorization

AuthorizationBearer <token>

A project secret key: vh_sk_... for production, vh_sk_test_... for test. Keep it on your servers.

In: header

Path parameters

projectId*string

The project's id, proj_.... A secret key works only in the project it belongs to.

paymentProviderId*string

The id of the project's payment provider connection, pp_conf_....

mappingId*string

The mapping's id, pp_prod_....

Request body

application/json

TypeScript definitions

Use the request body type in TypeScript.

configuration?|

Replaces the mapping's settings, such as its offers. The store product of a mapping with purchases cannot change.

environment?|

A payment source mapping's new environment, production, test or all; see the create body.

Examples

curl -X PATCH "https://api.voidhash.com/api/v1/projects/proj_tz4a98xxat96iws9zmbrgj3a/payment-providers/pp_conf_k2v8d4m1x7c9b3n6q0w5e2r8/products/pp_prod_q4w8e2r6t1y5u9i3o7p0a2s6" \  -H "Authorization: Bearer vh_sk_..." \  -H "Content-Type: application/json" \  -d '{    "configuration": {      "productId": "com.example.pro_monthly",      "offers": [        {          "id": "winback-50",          "offerId": "com.example.winback_50"        }      ]    }  }'
{  "id": "pp_prod_q4w8e2r6t1y5u9i3o7p0a2s6",  "paymentProviderId": "pp_conf_k2v8d4m1x7c9b3n6q0w5e2r8",  "productId": "prod_x8k2m5q9v3n7c1z4w6e0r2t5",  "providerProductKey": "com.example.pro_monthly",  "isActive": true,  "isSold": true,  "environment": "all",  "configuration": {    "productId": "com.example.pro_monthly",    "offers": [      {        "id": "winback-50",        "offerId": "com.example.winback_50"      }    ]  }}
{  "error": {    "type": "invalid_request",    "code": "invalid_product_mapping",    "message": "Price price_1PqR8sT2uV3wX4yZ belongs to Stripe product prod_Qa1Bc2De3Fg4Hi, not prod_Qz9Yx8Wv7Ut6Sr",    "param": "configuration"  }}
{  "error": {    "type": "unauthenticated",    "code": "invalid_api_key",    "message": "This secret key is not valid."  }}
{  "error": {    "type": "permission_denied",    "code": "permission_denied",    "message": "Insufficient permissions."  }}
{  "error": {    "type": "not_found",    "code": "project_not_found",    "message": "There is no project proj_tz4a98xxat96iws9zmbrgj3a, or this credential cannot use it.",    "param": "projectId"  }}
{  "error": {    "type": "internal",    "code": "internal_error",    "message": "Something went wrong on our side. Try again, and contact support with the Request-Id header if it keeps failing."  }}

Response body

application/json

application/json

application/json

application/json

application/json

application/json

Errors

StatustypecodeWhen
400invalid_requestinvalid_product_mappingWhen changing the store product of a mapping with purchases, or taking over a store product linked to another product.

It can also fail with the errors every operation shares, such as unauthenticated; see Errors.

More in Payment provider products

Something wrong or missing on this page? Tell us by email or on Discord.