openapi: 3.2.0 info: title: pinch-api Tokens API version: '2020.1' servers: - url: https://api.getpinch.com.au/test security: - sec0: [] tags: - name: Tokens paths: /tokens: post: summary: Tokenise Payment Source description: Safely submit credit card or bank account details to our servers in exchange for a token that can be used in future. operationId: tokenise requestBody: content: application/json: schema: type: object required: - publishableKey properties: publishableKey: type: string description: The publishable key found in your API Keys settings sourceType: type: string description: The type of payment source to tokenise. enum: - credit-card - bank-account cardNumber: type: string description: '[Credit Card] The credit card number. (Required if tokenising a Credit Card)' cvc: type: string description: '[Credit Card] The verification code found on the back of the credit card. (Required if tokenising a Credit Card)' expiryMonth: type: integer description: '[Credit Card] The two digit expiry month. (Required if tokenising a Credit Card)' format: int32 expiryYear: type: integer description: '[Credit Card] The four-digit expiry year. (Required if tokenising a Credit Card)' format: int32 cardHolderName: type: string description: '[Credit Card] The name of the person who owns the credit card. (Required if tokenising a Credit Card)' bankAccountName: type: string description: '[Bank Account] The name of the bank account. (Required if tokenising a Bank Account)' bankAccountRouting: type: string description: '[Bank Account] The Routing number of the bank account. Referred to as BSB in Australia, normally the first 6 digits of a New Zealand account number. (Required if tokenising a Bank Account)' bankAccountNumber: type: string description: '[Bank Account] The Bank account number not including the Routing number. (Required if tokenising a Bank Account)' responses: '200': description: '200' content: application/json: examples: Result: value: "{\n \"token\": \"tkn_XXXXXXXXXXXXXXXXXXXXXX\",\n \"cardHolderName\": \"Ben Hotdog\",\n \"displayCardNumber\": \"4242\",\n \"expiryDate\": \"2022-12-01T00:00:00Z\",\n \"cardScheme\": \"visa\",\n \"origin\": \"AU\"\n}" schema: type: object properties: token: type: string example: tkn_XXXXXXXXXXXXXXXXXXXXXX cardHolderName: type: string example: Ben Hotdog displayCardNumber: type: string example: '4242' expiryDate: type: string example: '2022-12-01T00:00:00Z' cardScheme: type: string example: visa origin: type: string example: AU '400': description: '400' content: application/json: examples: Result: value: "[\n {\n \"propertyName\": \"\",\n \"errorMessage\": \"Invalid publishable key: pk_test_XXXXXXXXX\",\n \"attemptedValue\": null,\n \"customState\": null,\n \"severity\": 0,\n \"errorCode\": null,\n \"formattedMessageArguments\": null,\n \"formattedMessagePlaceholderValues\": null,\n \"resourceName\": null\n }\n]" schema: type: array items: type: object properties: propertyName: type: string example: '' errorMessage: type: string example: 'Invalid publishable key: pk_test_XXXXXXXXX' attemptedValue: {} customState: {} severity: type: integer example: 0 default: 0 errorCode: {} formattedMessageArguments: {} formattedMessagePlaceholderValues: {} resourceName: {} '403': description: '403' content: text/plain: examples: Result: value: '' deprecated: false security: [] x-readme: code-samples: - language: curl code: "curl https://api.getpinch.com.au/test/tokens\n -H \"Content-Type: application/json\" \n -d \"{\n 'publishableKey': 'pk_test_hjbdslfkjhb8789oplrblsdf8bl',\n 'sourceType': 'credit-card',\n 'cardNumber': '4242424242424242',\n 'cvc\": '123',\n 'expiryMonth': 12,\n 'expiryYear': 2022,\n 'cardHolderName': 'Ben Hotdog'\n\t\t}\"" name: credit-card - language: curl code: "curl https://api.getpinch.com.au/test/tokens\n -H \"Content-Type: application/json\" \n -d \"{\n 'publishableKey': 'pk_test_hjbdslfkjhb8789oplrblsdf8bl',\n 'sourceType': 'bank-account',\n 'bankAccountName': 'Ben Hotdog',\n 'bankAccountRoutingNumber\": '001001',\n 'bankAccountNumber': '001001001'\n\t\t}\"" name: bank-account samples-languages: - curl tags: - Tokens components: securitySchemes: sec0: type: oauth2 flows: {} x-readme: headers: - key: pinch-version value: '2020.1' explorer-enabled: true proxy-enabled: true