Unlock Protocol Purchase API
The Purchase API from Unlock Protocol — 6 operation(s) for purchase.
The Purchase API from Unlock Protocol — 6 operation(s) for purchase.
openapi: 3.0.0
info:
title: Unlock Locksmith Applications Purchase API
version: '2'
description: Locksmith provides backend functionality for enabling ticketing, metadata storage, and notification hooks.
license:
name: MIT
servers:
- url: https://locksmith.unlock-protocol.com
description: Production Server
- url: https://staging-locksmith.unlock-protocol.com
description: Staging Server
tags:
- name: Purchase
paths:
/purchase:
get:
operationId: balance
responses:
200:
description: Balances for purchaser addresses on each network.
content:
application/json:
schema:
nullable: false
type: object
additionalProperties:
type: object
nullable: true
properties:
address:
type: string
name:
type: string
balance:
type: string
500:
$ref: '#/components/responses/500.InternalError'
tags:
- Purchase
/v2/purchase/intent/{network}/locks/{lockAddress}:
post:
operationId: purchase
security:
- User: []
description: Create purchase intent for stripe.
parameters:
- $ref: '#/components/parameters/Network'
- $ref: '#/components/parameters/LockAddress'
requestBody:
required: true
content:
application/json:
schema:
required:
- recipients
- stripeTokenId
- pricing
type: object
properties:
recipients:
type: array
items:
type: string
minItems: 1
stripeTokenId:
type: string
pricing:
type: number
recurring:
type: number
nullable: true
data:
type: array
items:
type: string
referrers:
type: array
items:
type: string
responses:
200:
description: Created payment intent client secret, account, and other details.
content:
application/json:
schema:
type: object
properties:
clientSecret:
type: string
stripeAccount:
type: string
totalPriceInDents:
type: number
pricing:
nullable: true
type: object
properties:
keyPrice:
type: number
nullable: true
unlockServiceFee:
type: number
nullable: true
creditCardProcessing:
type: number
nullable: true
400:
$ref: '#/components/responses/400.Invalid'
tags:
- Purchase
/v2/purchase/setup:
post:
operationId: setupPayment
security:
- User: []
description: Setup a payment method for user.
responses:
200:
description: Created setup intent client secret.
content:
application/json:
schema:
type: object
properties:
clientSecret:
type: string
401:
$ref: '#/components/responses/401.NotAuthenticated'
tags:
- Purchase
/v2/purchase/list:
get:
operationId: listPaymentMethods
security:
- User: []
description: List payment methods for user.
responses:
200:
description: Stripe payment methods for user.
content:
application/json:
schema:
type: object
properties:
methods:
type: array
items:
$ref: '#/components/schemas/PaymentMethod'
401:
$ref: '#/components/responses/401.NotAuthenticated'
tags:
- Purchase
/v2/purchase/payment-methods:
delete:
operationId: removePaymentMethods
security:
- User: []
description: Remove all payment methods for a user
responses:
200:
description: Successfully removed all payment methods
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
401:
$ref: '#/components/responses/401.NotAuthenticated'
tags:
- Purchase
/purchase/capture:
post:
operationId: capturePurchase
security:
- User: []
description: Capture a purchase
requestBody:
content:
application/json:
schema:
type: object
required:
- network
- lock
- userAddress
- paymentIntent
properties:
recipients:
type: array
items:
type: string
network:
type: number
lock:
type: string
userAddress:
type: string
paymentIntent:
type: string
data:
type: array
items:
type: string
referrers:
type: array
items:
type: string
purchaseType:
type: string
description: whether to extend or purchase membership for the recipient.
enum:
- extend
- purchase
responses:
200:
description: Successfully captured purchase
content:
application/json:
schema:
type: object
properties:
transactionHash:
type: string
tags:
- Purchase
components:
schemas:
GenericInvalidBodyError:
type: object
nullable: false
properties:
message:
type: string
default: Response body schema is invalid.
nullable: false
error:
type: string
nullable: true
GenericServerError:
type: object
nullable: false
properties:
message:
type: string
default: There was an error in fullfiling the request.
nullable: false
PaymentMethod:
type: object
properties:
id:
type: string
object:
type: string
billing_details:
type: object
properties:
address:
type: object
properties:
city:
type: string
format: nullable
country:
type: string
line1:
type: string
format: nullable
line2:
type: string
format: nullable
postal_code:
type: string
format: nullable
state:
type: string
format: nullable
email:
type: string
format: nullable
name:
type: string
phone:
type: string
format: nullable
card:
type: object
properties:
brand:
type: string
checks:
type: object
properties:
address_line1_check:
type: string
format: nullable
address_postal_code_check:
type: string
format: nullable
cvc_check:
type: string
country:
type: string
exp_month:
type: number
exp_year:
type: number
fingerprint:
type: string
funding:
type: string
generated_from:
type: string
format: nullable
last4:
type: string
networks:
type: object
properties:
available:
type: array
items:
type: string
preferred:
type: string
format: nullable
three_d_secure_usage:
type: object
properties:
supported:
type: boolean
wallet:
type: string
format: nullable
created:
type: number
customer:
type: string
livemode:
type: boolean
metadata:
type: object
additionalProperties: true
type:
type: string
responses:
400.Invalid:
description: Invalid input received. Bad request.
content:
application/json:
schema:
$ref: '#/components/schemas/GenericInvalidBodyError'
401.NotAuthenticated:
description: User is not authenticated.
content:
application:
schema:
$ref: '#/components/schemas/GenericServerError'
500.InternalError:
description: Unable to fullfil request due to internal server error.
content:
application/json:
schema:
$ref: '#/components/schemas/GenericServerError'
parameters:
Network:
in: path
name: network
required: true
description: Network id.
schema:
type: integer
LockAddress:
in: path
name: lockAddress
required: true
description: Lock address.
schema:
type: string
securitySchemes:
User:
type: http
scheme: bearer
bearerFormat: JWT
Application:
type: apiKey
name: api-key
in: query