V1Contracts

保証契約作成

POST
/v1/contracts

保証契約の永続化は非同期に行われる為、直後にGET APIを呼び出すと対象の保証契約を取得する事が出来ない可能性があります。

X-Proteger-Auth-Token<token>

In: header

Header Parameters

X-Proteger-Auth-Token*string

protegerAccessToken

Content-Type*string

application/json

Accept*string

application/json

X-Idempotency-Key?string

べき等性を保証するためにランダムに生成された文字列(v4 UUIDを推奨)。べき等性のページを参照してください。

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://example.com/v1/contracts" \  -H "X-Proteger-Auth-Token: string" \  -H "Content-Type: string" \  -H "Accept: string" \  -H "Content-Type: application/json" \  -d '{    "transactionId": "bhiuw289biuy03bnashjio",    "transactionTotal": 12000,    "transactionDate": "2021-01-31T13:16:06.239289+09:00",    "customer": {      "name": "山田 太郎",      "email": "user@example.com"    },    "product": {      "referenceId": "c10a0882-2b11-633d-7de6-0563bbf9dbed",      "purchasePrice": 10000    },    "plan": {      "purchasePrice": 2000,      "planId": "c10a0882-2b11-633d-7de6-0563bbf9dbed"    }  }'
{  "id": "c10a0882-2b11-633d-7de6-0563bbf9dbed",  "inquiryCode": "892hv238",  "transactionId": "order0001",  "transactionTotal": 12000,  "transactionDate": "2021-01-31T13:16:06.239289+09:00",  "customer": {    "id": "c10a0882-2b11-633d-7de6-0563bbf9dbed",    "referenceId": "c10a0882-2b11-633d-7de6-0563bbf9dbed",    "name": "山田 太郎",    "email": "user@example.com",    "phone": "0120-XXXX-XXXX",    "billingAddress": {      "postalNumber": "227-0043",      "prefecture": "神奈川県",      "city": "横浜市青葉区藤が丘",      "address": "1-49-1",      "building": "XXXハイム 306"    },    "shippingAddress": {      "postalNumber": "227-0043",      "prefecture": "神奈川県",      "city": "横浜市青葉区藤が丘",      "address": "1-49-1",      "building": "XXXハイム 306"    }  },  "product": {    "id": "c10a0882-2b11-633d-7de6-0563bbf9dbed",    "referenceId": "c10a0882-2b11-633d-7de6-0563bbf9dbed",    "title": "ノートPC",    "price": 10000,    "imageUrl": "https://helloproteger.com/image/10vj12.png",    "category": "パソコン",    "brand": "Apple",    "purchasePrice": 10000,    "serialNumber": "12304981",    "createdAt": "2021-01-31T13:16:06.239289+09:00",    "updatedAt": "2021-01-31T13:16:06.239289+09:00"  },  "plan": {    "id": "c10a0882-2b11-633d-7de6-0563bbf9dbed",    "title": "1年延長保証",    "price": 2000,    "termLength": 12,    "serviceType": "Repair",    "protectionType": "Base",    "url": "string"  },  "store": {    "id": "c10a0882-2b11-633d-7de6-0563bbf9dbed",    "name": "proteger公式オンラインストア",    "webSite": "https://hi.helloproteger.com",    "logoUrl": "https://helloproteger.com/logo.png"  },  "isFulfilled": true,  "status": "Active",  "fraud": false,  "startedAt": "2021-01-31T13:16:06.239289+09:00",  "endedAt": "2021-01-31T13:16:06.239289+09:00",  "createdAt": "2021-01-31T13:16:06.239289+09:00",  "updatedAt": "2021-01-31T13:16:06.239289+09:00"}
{  "requestId": "kJZQv3lyB2rjHKNbeGBy5HMet4MO0nw9",  "code": "BadRequestException",  "error": "failed create contract: failed get product: not found"}