Documentation
¶
Index ¶
- func CompareWebhookSignature(ctx context.Context, req *entity.WebhookResource, ...) error
- type Client
- func (c *Client) CancelCharge(ctx context.Context, req *entity.CancelChargeReq) (*entity.CancelChargeResp, error)
- func (c *Client) CreateCharge(ctx context.Context, req *entity.CreateChargeReq) (*entity.CreateChargeResp, error)
- func (c *Client) CreateCheckout(ctx context.Context, req *entity.CreateCheckoutReq) (*entity.CreateCheckoutResp, error)
- func (c *Client) CreateInvoice(ctx context.Context, req *entity.CreateInvoiceReq) (*entity.CreateInvoiceResp, error)
- func (c *Client) DeleteCheckout(ctx context.Context, req *entity.DeleteCheckoutReq) (*entity.DeleteCheckoutResp, error)
- func (c *Client) ListCharges(ctx context.Context, req *entity.ListChargesReq) (*entity.ListChargesResp, error)
- func (c *Client) ListCheckouts(ctx context.Context, req *entity.ListCheckoutsReq) (*entity.ListCheckoutsResp, error)
- func (c *Client) ListEvents(ctx context.Context, req *entity.ListEventsReq) (*entity.ListEventsResp, error)
- func (c *Client) ListInvoices(ctx context.Context, req *entity.ListInvoicesReq) (*entity.ListInvoicesResp, error)
- func (c *Client) ResolveCharge(ctx context.Context, req *entity.ResolveChargeReq) (*entity.ResolveChargeResp, error)
- func (c *Client) ResolveInvoice(ctx context.Context, req *entity.ResolveInvoiceReq) (*entity.ResolveInvoiceResp, error)
- func (c *Client) ShowCharge(ctx context.Context, req *entity.ShowChargeReq) (*entity.ShowChargeResp, error)
- func (c *Client) ShowCheckout(ctx context.Context, req *entity.ShowCheckoutReq) (*entity.ShowCheckoutResp, error)
- func (c *Client) ShowEvent(ctx context.Context, req *entity.ShowEventReq) (*entity.ShowEventResp, error)
- func (c *Client) ShowInvoice(ctx context.Context, req *entity.ShowInvoiceReq) (*entity.ShowInvoiceResp, error)
- func (c *Client) UpdateCheckout(ctx context.Context, req *entity.UpdateCheckoutReq) (*entity.UpdateCheckoutResp, error)
- func (c *Client) VoidInvoice(ctx context.Context, req *entity.VoidInvoiceReq) (*entity.VoidInvoiceResp, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareWebhookSignature ¶ added in v1.0.0
func CompareWebhookSignature(ctx context.Context, req *entity.WebhookResource, receivedSignature, sharedSecretKey string) error
CompareWebhookSignature used for the handler middleware to verify webhook. Mismatch signature will return an error.
Payload: req => from request body. receivedSignature => from "X-CC-Webhook-Signature" header. sharedSecretKey => from webhook setting page secret key.
Reference: https://commerce.coinbase.com/docs/api/#securing-webhooks
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the main client to interact with Coinbase Commerce API.
func (*Client) CancelCharge ¶
func (c *Client) CancelCharge(ctx context.Context, req *entity.CancelChargeReq) (*entity.CancelChargeResp, error)
CancelCharge cancels a charge that has been previously created. Supply the unique charge code or id that was returned when the charge was created. This information is also returned when a charge is first created.
Note: Only new charges can be successfully canceled. Once payment is detected, charge can no longer be canceled.
Reference: https://commerce.coinbase.com/docs/api/#cancel-a-charge
func (*Client) CreateCharge ¶
func (c *Client) CreateCharge(ctx context.Context, req *entity.CreateChargeReq) (*entity.CreateChargeResp, error)
CreateCharge charge a customer with certain amount of currency. To get paid in cryptocurrency, you need to create a charge object and provide the user with a cryptocurrency address to which they must send cryptocurrency. Once a charge is created a customer must broadcast a payment to the blockchain before the charge expires. Reference: https://commerce.coinbase.com/docs/api/#create-a-charge
func (*Client) CreateCheckout ¶ added in v0.0.3
func (c *Client) CreateCheckout(ctx context.Context, req *entity.CreateCheckoutReq) (*entity.CreateCheckoutResp, error)
CreateCheckout create a new checkout. Reference: https://commerce.coinbase.com/docs/api/#create-a-checkout
func (*Client) CreateInvoice ¶ added in v0.0.4
func (c *Client) CreateInvoice(ctx context.Context, req *entity.CreateInvoiceReq) (*entity.CreateInvoiceResp, error)
CreateInvoice to send an invoice in cryptocurrency, you need to create an invoice object and provide the user with the hosted url where they will be able to pay. Once an invoice is viewed at the hosted url, a charge will be generated on the invoice. Reference: https://commerce.coinbase.com/docs/api/#create-an-invoice
func (*Client) DeleteCheckout ¶ added in v0.0.3
func (c *Client) DeleteCheckout(ctx context.Context, req *entity.DeleteCheckoutReq) (*entity.DeleteCheckoutResp, error)
DeleteCheckout delete a checkout. Reference: https://commerce.coinbase.com/docs/api/#delete-a-checkout
func (*Client) ListCharges ¶
func (c *Client) ListCharges(ctx context.Context, req *entity.ListChargesReq) (*entity.ListChargesResp, error)
ListCharges lists all the charges. Reference: https://commerce.coinbase.com/docs/api/#list-charges
func (*Client) ListCheckouts ¶ added in v0.0.3
func (c *Client) ListCheckouts(ctx context.Context, req *entity.ListCheckoutsReq) (*entity.ListCheckoutsResp, error)
ListCheckouts lists all the checkouts. Reference: https://commerce.coinbase.com/docs/api/#list-checkouts
func (*Client) ListEvents ¶ added in v1.0.0
func (c *Client) ListEvents(ctx context.Context, req *entity.ListEventsReq) (*entity.ListEventsResp, error)
ListEvents lists all the events. Reference: https://commerce.coinbase.com/docs/api/#list-events
func (*Client) ListInvoices ¶ added in v0.0.4
func (c *Client) ListInvoices(ctx context.Context, req *entity.ListInvoicesReq) (*entity.ListInvoicesResp, error)
ListInvoices lists all the invoices. Reference: https://commerce.coinbase.com/docs/api/#list-invoices
func (*Client) ResolveCharge ¶
func (c *Client) ResolveCharge(ctx context.Context, req *entity.ResolveChargeReq) (*entity.ResolveChargeResp, error)
ResolveCharge resolves a charge that has been previously marked as unresolved. Supply the unique charge code or id that was returned when the charge was created. This information is also returned when a charge is first created.
Note: Only unresolved charges can be successfully resolved
Reference: https://commerce.coinbase.com/docs/api/#resolve-a-charge
func (*Client) ResolveInvoice ¶ added in v0.0.4
func (c *Client) ResolveInvoice(ctx context.Context, req *entity.ResolveInvoiceReq) (*entity.ResolveInvoiceResp, error)
ResolveInvoice resolve an invoice that has been previously marked as unresolved. Supply the unique invoice code or id that was returned when the charge was created.
Note: Only invoices with an unresolved charge can be successfully resolved.
Reference: https://commerce.coinbase.com/docs/api/#resolve-an-invoice
func (*Client) ShowCharge ¶
func (c *Client) ShowCharge(ctx context.Context, req *entity.ShowChargeReq) (*entity.ShowChargeResp, error)
ShowCharge retrieves the details of a charge that has been previously created. Supply the unique charge code or id that was returned when the charge was created. This information is also returned when a charge is first created. Reference: https://commerce.coinbase.com/docs/api/#show-a-charge
func (*Client) ShowCheckout ¶ added in v0.0.3
func (c *Client) ShowCheckout(ctx context.Context, req *entity.ShowCheckoutReq) (*entity.ShowCheckoutResp, error)
ShowCheckout show a single checkout. Reference: https://commerce.coinbase.com/docs/api/#show-a-checkout
func (*Client) ShowEvent ¶ added in v1.0.0
func (c *Client) ShowEvent(ctx context.Context, req *entity.ShowEventReq) (*entity.ShowEventResp, error)
ShowEvent retrieves the details of an event. Supply the unique identifier of the event, which you might have received in a webhook. Reference: https://commerce.coinbase.com/docs/api/#show-an-event
func (*Client) ShowInvoice ¶ added in v0.0.4
func (c *Client) ShowInvoice(ctx context.Context, req *entity.ShowInvoiceReq) (*entity.ShowInvoiceResp, error)
ShowInvoice retrieves the details of an invoice that has been previously created. Supply the unique invoice code or id that was returned when the charge was created. This information is also returned when an invoice is first created. Reference: https://commerce.coinbase.com/docs/api/#show-an-invoice
func (*Client) UpdateCheckout ¶ added in v0.0.3
func (c *Client) UpdateCheckout(ctx context.Context, req *entity.UpdateCheckoutReq) (*entity.UpdateCheckoutResp, error)
UpdateCheckout update a checkout. Reference: https://commerce.coinbase.com/docs/api/#update-a-checkout
func (*Client) VoidInvoice ¶ added in v0.0.4
func (c *Client) VoidInvoice(ctx context.Context, req *entity.VoidInvoiceReq) (*entity.VoidInvoiceResp, error)
VoidInvoice voids an invoice that has been previously created. Supply the unique invoice code or id that was returned when the charge was created.
Note: Only invoices with OPEN or VIEWED status can be voided. Once a payment is detected, the invoice can no longer be voided.
Reference: https://commerce.coinbase.com/docs/api/#void-an-invoice