circlesdk

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 9, 2023 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package circlesdk provides a client to securely and easily consume Circle's APIs.

More information: https://developers.circle.com/docs/introducing-circle-apis

Index

Constants

View Source
const Version = "0.1.0"

Version identifier for the SDK.

Variables

This section is empty.

Functions

func NewIdempotencyKey

func NewIdempotencyKey() string

NewIdempotencyKey returns a random/valid new key that can be used to submit idempotent API requests. https://developers.circle.com/docs/a-note-on-idempotent-requests

Types

type Amount

type Amount struct {
	// Magnitude of the amount, in units of the currency.
	Amount string `json:"amount,omitempty"`

	// Currency code for the amount.
	Currency string `json:"currency,omitempty"`
}

Amount provides information for a specific amount/currency pair.

type Balance

type Balance struct {
	// List of currency balances (one for each currency) that are currently available
	// to spend.
	Available []Amount `json:"available,omitempty"`

	// List of currency balances (one for each currency) that have been captured but are
	// currently in the process of settling and will become available to spend at some
	// point in the future.
	Unsettled []Amount `json:"unsettled,omitempty"`
}

Balance of funds that are available for use.

type BankAccount

type BankAccount struct {
	// Unique system generated identifier for the payment item.
	ID string `json:"id,omitempty"`

	// Status of the account.
	// A pending status indicates that the linking is in-progress;
	// complete indicates the account was linked successfully;
	// failed indicates it failed.
	Status BankAccountStatus `json:"status,omitempty"`

	// Bank name plus last four digits of the bank account number or IBAN.
	Description string `json:"description,omitempty"`

	// Wire tracking ref that needs to be set in the wire reference to beneficiary field.
	TrackingRef string `json:"trackingRef,omitempty"`

	// The redacted account number of the ACH account.
	AccountNumber string `json:"accountNumber,omitempty"`

	// The routing number of the ACH account.
	RoutingNumber string `json:"routingNumber,omitempty"`

	// Object containing billing details for the bank account.
	BillingDetails *BillingDetails `json:"billingDetails,omitempty"`

	// The address details for the bank, as provided during bank account creation.
	BankAddress *BankAddress `json:"bankAddress,omitempty"`

	// A UUID that uniquely identifies the account number.
	// If the same account is used more than once, each card object will have a different id,
	// but the fingerprint will stay the same.
	Fingerprint string `json:"fingerprint,omitempty"`

	// Indicates the failure reason of the ACH account. Only present on failed accounts.
	// Possible values are [bank_account_authorization_expired, bank_account_error,
	// bank_account_ineligible, bank_account_not_found, bank_account_unauthorized,
	// unsupported_routing_number, verification_failed].
	ErrorCode BankAccountErrorCode `json:"errorCode,omitempty"`

	// Results of risk evaluation. Only present if the payment is denied by Circle's risk service.
	RiskEvaluation *RiskEvaluation `json:"riskEvaluation,omitempty"`

	// Object containing metadata for the bank account
	Metadata *Metadata `json:"metadata,omitempty"`

	// ISO-8601 UTC date/time format of the bank account creation date.
	CreateDate string `json:"createDate,omitempty"`

	// ISO-8601 UTC date/time format of the bank account update date.
	UpdateDate string `json:"updateDate"`
}

BankAccount is the object contain the bank account data returned from the API.

type BankAccountErrorCode

type BankAccountErrorCode string

BankAccountErrorCode contains the error code value for the bank account.

const (
	// BankAccountErrorCodeBankAccountAuthorizationExpired = "bank_account_authorization_expired".
	BankAccountErrorCodeBankAccountAuthorizationExpired BankAccountErrorCode = "bank_account_authorization_expired"

	// BankAccountErrorCodeBankAccountError = "bank_account_error".
	BankAccountErrorCodeBankAccountError BankAccountErrorCode = "bank_account_error"

	// BankAccountErrorCodeBankAccountIneligible = "bank_account_ineligible".
	BankAccountErrorCodeBankAccountIneligible BankAccountErrorCode = "bank_account_ineligible"

	// BankAccountErrorCodeBankAccountNotFound = "bank_account_not_found".
	BankAccountErrorCodeBankAccountNotFound BankAccountErrorCode = "bank_account_not_found"

	// BankAccountErrorCodeBankAccountUnauthorized = "bank_account_unauthorized".
	BankAccountErrorCodeBankAccountUnauthorized BankAccountErrorCode = "bank_account_unauthorized"

	// BankAccountErrorCodeUnsupportedRoutingNumber = "unsupported_routing_number".
	BankAccountErrorCodeUnsupportedRoutingNumber BankAccountErrorCode = "unsupported_routing_number"

	// BankAccountErrorCodeVerificationFailed = "verification_failed".
	BankAccountErrorCodeVerificationFailed BankAccountErrorCode = "verification_failed"
)

type BankAccountStatus

type BankAccountStatus string

BankAccountStatus contains the status value for the bank account.

const (
	// BankAccountStatusPending = "pending".
	BankAccountStatusPending BankAccountStatus = "pending"

	// BankAccountStatusComplete = "complete".
	BankAccountStatusComplete BankAccountStatus = "complete"

	// BankAccountStatusFailed = "failed".
	BankAccountStatusFailed BankAccountStatus = "failed"
)

type BankAddress

type BankAddress struct {
	// Name of the bank.
	// This property is required for bank accounts outside of the US that do not support IBAN'
	BankName string `json:"bankName,omitempty"`

	// City portion of the address.
	// This property is required for bank accounts outside of the US.
	City string `json:"city,omitempty"`

	// Country portion of the address.
	// Formatted as a two-letter country code specified in ISO 3166-1 alpha-2.
	Country string `json:"country,omitempty"`

	// Line one of the street address.
	Line1 string `json:"line1,omitempty"`

	// Line two of the street address.
	Line2 string `json:"line2,omitempty"`

	// State / County / Province / Region portion of the address.
	// US and Canada use the two-letter code for the subdivision.
	District string `json:"district,omitempty"`
}

BankAddress contains address details for the bank, as provided during bank account creation.

type BillingDetails

type BillingDetails struct {
	// Full name of the card or bank account holder.
	Name string `json:"name,omitempty"`

	// City portion of the address.
	City string `json:"city,omitempty"`

	// Country portion of the address.
	// Formatted as a two-letter country code specified in ISO 3166-1 alpha-2.
	Country string `json:"country,omitempty"`

	// Line one of the street address.
	Line1 string `json:"line1,omitempty"`

	// Line two of the street address.
	Line2 string `json:"line2,omitempty"`

	// State / County / Province / Region portion of the address.
	// If the country is US or Canada, then district is required
	// and should use the two-letter code for the subdivision.
	District string `json:"district,omitempty"`

	// Postal / ZIP code of the address.
	PostalCode string `json:"postalCode,omitempty"`
}

BillingDetails is the object containing billing details for the entity.

type CallOption

type CallOption func(*RequestOptions) error

CallOption settings allow you to adjust the behavior of specific API calls.

func WithContext

func WithContext(ctx context.Context) CallOption

WithContext allows you to provide a custom context to the API call.

func WithDateRange

func WithDateRange(from, to time.Time) CallOption

WithDateRange limits the collection items returned by API calls to the specified date range (inclusive).

func WithIdempotencyKey

func WithIdempotencyKey(ik string) CallOption

WithIdempotencyKey makes the request idempotent so that you can safely retry API calls when things go wrong before you receive a response. If "ik" is empty a new valid idempotency key will be generated. https://developers.circle.com/docs/a-note-on-idempotent-requests

func WithPageAfter

func WithPageAfter(id string) CallOption

WithPageAfter marks the exclusive begin of a page. When provided, the collection resource will return the next n items after the id, with n being specified by pageSize.

func WithPageBefore

func WithPageBefore(id string) CallOption

WithPageBefore marks the exclusive end of a page. When provided, the collection resource will return the next n items before the id, with n being specified by pageSize.

func WithPageSize

func WithPageSize(size uint) CallOption

WithPageSize limits the number of items to be returned by API calls returning collections. Some collections have a strict upper bound that will disregard this value. In case the specified value is higher than the allowed limit, the collection limit will be used. If not provided, the collection will determine the page size itself.

type CancelPaymentRequest

type CancelPaymentRequest struct {
	// Universally unique identifier (UUID v4) idempotency key.
	// This key is utilized to ensure exactly-once execution of mutating requests.
	IdempotencyKey string `json:"idempotencyKey,omitempty"`

	// Enumerated reason for a returned payment.
	// Providing this reason in the request is recommended (to improve risk evaluation) but not required.
	Reason string `json:"reason,omitempty"`
}

CancelPaymentRequest contains the data to cancel a payment.

type CapturePaymentRequest

type CapturePaymentRequest struct {
	// Universally unique identifier (UUID v4) idempotency key.
	// This key is utilized to ensure exactly-once execution of mutating requests.
	IdempotencyKey string `json:"idempotencyKey,omitempty"`

	// Amount object for the payment capture
	Amount *Amount `json:"amount,omitempty"`
}

CapturePaymentRequest contains the data to capture a payment.

type Card

type Card struct {
	// Unique system generated identifier for the payment item.
	ID string `json:"id,omitempty"`

	// Status of the account.
	// A pending status indicates that the linking is in-progress;
	// complete indicates the account was linked successfully;
	// failed indicates it failed.
	Status CardStatus `json:"status,omitempty"`

	// Object containing billing details for the card.
	BillingDetails *BillingDetails `json:"billingDetails,omitempty"`

	// Two digit number representing the card's expiration month.
	ExpMonth int `json:"expMonth,omitempty"`

	// Four digit number representing the card's expiration year.
	ExpYear int `json:"expYear,omitempty"`

	// The network of the card.
	// options: VISA, MASTERCARD, AMEX, UNKNOWN
	Network CardNetwork `json:"network,omitempty"`

	// The last 4 digits of the card.
	Last4 string `json:"last4,omitempty"`

	// The bank identification number (BIN), the first 6 digits of the card.
	Bin string `json:"bin,omitempty"`

	// The country code of the issuer bank. Follows the ISO 3166-1 alpha-2 standard.
	IssuerCountry string `json:"issuerCountry,omitempty"`

	// The funding type of the card. Possible values are credit, debit, prepaid, and unknown.
	FundingType CardFundingType `json:"fundingType,omitempty"`

	// A UUID that uniquely identifies the account number.
	// If the same account is used more than once, each card object will have a different id,
	// but the fingerprint will stay the same.
	Fingerprint string `json:"fingerprint,omitempty"`

	// Indicates the failure reason of the card verification. Only present on cards with failed verification.
	// Possible values are [verification_failed, verification_fraud_detected, verification_denied,
	// verification_not_supported_by_issuer, verification_stopped_by_issuer, card_failed, card_invalid,
	// card_address_mismatch, card_zip_mismatch, card_cvv_invalid, card_expired, card_limit_violated,
	// card_not_honored, card_cvv_required, credit_card_not_allowed, card_account_ineligible, card_network_unsupported]'
	ErrorCode CardErrorCode `json:"errorCode,omitempty"`

	// Indicates the status of the card for verification purposes.
	Verification *CardVerification `json:"verification,omitempty"`

	// Results of risk evaluation. Only present if the payment is denied by Circle's risk service.
	RiskEvaluation *RiskEvaluation `json:"riskEvaluation,omitempty"`

	// Object containing metadata for the card
	Metadata *Metadata `json:"metadata,omitempty"`

	// ISO-8601 UTC date/time format of the card creation date.
	CreateDate string `json:"createDate,omitempty"`

	// ISO-8601 UTC date/time format of the card update date.
	UpdateDate string `json:"updateDate"`
}

Card is the object contain the card data returned from the API.

type CardErrorCode

type CardErrorCode string

CardErrorCode contains the error code value for the card.

const (
	// CardErrorCodeVerificationFailed = "verification_failed".
	CardErrorCodeVerificationFailed CardErrorCode = "verification_failed"

	// CardErrorCodeVerificationFraudDetected = "verification_fraud_detected".
	CardErrorCodeVerificationFraudDetected CardErrorCode = "verification_fraud_detected"

	// CardErrorCodeVerificationDenied = "verification_denied".
	CardErrorCodeVerificationDenied CardErrorCode = "verification_denied"

	// CardErrorCodeVerificationNotSupportedByIssuer = "verification_not_supported_by_issuer".
	CardErrorCodeVerificationNotSupportedByIssuer CardErrorCode = "verification_not_supported_by_issuer"

	// CardErrorCodeVerificationStoppedByIssuer = "verification_stopped_by_issuer".
	CardErrorCodeVerificationStoppedByIssuer CardErrorCode = "verification_stopped_by_issuer"

	// CardErrorCodeCardFailed = "card_failed".
	CardErrorCodeCardFailed CardErrorCode = "card_failed"

	// CardErrorCodeCardInvalid = "card_invalid".
	CardErrorCodeCardInvalid CardErrorCode = "card_invalid"

	// CardErrorCodeCardAddressMismatch = "card_address_mismatch".
	CardErrorCodeCardAddressMismatch CardErrorCode = "card_address_mismatch"

	// CardErrorCodeCardZipMismatch = "card_zip_mismatch".
	CardErrorCodeCardZipMismatch CardErrorCode = "card_zip_mismatch"

	// CardErrorCodeCardCvvInvalid = "card_cvv_invalid".
	CardErrorCodeCardCvvInvalid CardErrorCode = "card_cvv_invalid"

	// CardErrorCodeCardExpired = "card_expired".
	CardErrorCodeCardExpired CardErrorCode = "card_expired"

	// CardErrorCodeCardLimitViolated = "card_limit_violated".
	CardErrorCodeCardLimitViolated CardErrorCode = "card_limit_violated"

	// CardErrorCodeCardNotHonored = "card_not_honored".
	CardErrorCodeCardNotHonored CardErrorCode = "card_not_honored"

	// CardErrorCodeCardCvvRequired = "card_cvv_required".
	CardErrorCodeCardCvvRequired CardErrorCode = "card_cvv_required"

	// CardErrorCodeCreditCardNotAllowed = "credit_card_not_allowed".
	CardErrorCodeCreditCardNotAllowed CardErrorCode = "credit_card_not_allowed"

	// CardErrorCodeCardAccountIneligible = "card_account_ineligible".
	CardErrorCodeCardAccountIneligible CardErrorCode = "card_account_ineligible"

	// CardErrorCodeCardNetworkUnsupported = "card_network_unsupported".
	CardErrorCodeCardNetworkUnsupported CardErrorCode = "card_network_unsupported"
)

type CardFundingType

type CardFundingType string

CardFundingType contains the funding type value for the card.

const (
	// CardFundingTypeCredit = "credit".
	CardFundingTypeCredit CardFundingType = "credit"

	// CardFundingTypeDebit = "debit".
	CardFundingTypeDebit CardFundingType = "debit"

	// CardFundingTypePrepaid = "prepaid".
	CardFundingTypePrepaid CardFundingType = "prepaid"

	// CardFundingTypeUnknown = "unknown".
	CardFundingTypeUnknown CardFundingType = "unknown"
)

credit, debit, prepaid, and unknown.

type CardNetwork

type CardNetwork string

CardNetwork contains the network value for the card.

const (
	// CardNetworkVISA = "VISA".
	CardNetworkVISA CardNetwork = "VISA"

	// CardNetworkMASTERCARD = "MASTERCARD".
	CardNetworkMASTERCARD CardNetwork = "MASTERCARD"

	// CardNetworkAMEX = "AMEX".
	CardNetworkAMEX CardNetwork = "AMEX"

	// CardNetworkUNKNOWN = "UNKNOWN".
	CardNetworkUNKNOWN CardNetwork = "UNKNOWN"
)

type CardStatus

type CardStatus string

CardStatus contains the status value for the card.

const (
	// CardStatusPending = "pending".
	CardStatusPending CardStatus = "pending"

	// CardStatusComplete = "complete".
	CardStatusComplete CardStatus = "complete"

	// CardStatusFailed = "failed".
	CardStatusFailed CardStatus = "failed"
)

type CardVerification

type CardVerification struct {
	// Status of the AVS check. Raw AVS response, expressed as an upper-case letter.
	// not_requested indicates check was not made. pending is pending/processing.
	Avs CardVerificationAvs `json:"avs,omitempty"`

	// Enumerated status of the check.
	// not_requested indicates check was not made.
	// pass indicates value is correct.
	// fail indicates value is incorrect.
	// unavailable indicates card issuer did not do the provided check.
	// pending indicates check is pending/processing.
	Cvv CardVerificationCvv `json:"cvv,omitempty"`
}

CardVerification indicates the status of the card for verification purposes.

type CardVerificationAvs

type CardVerificationAvs string

CardVerificationAvs contains the avs value for the card verification.

const (
	// CardVerificationAvsNotRequested = "not_requested".
	CardVerificationAvsNotRequested CardVerificationAvs = "not_requested"

	// CardVerificationAvsPending = "pending".
	CardVerificationAvsPending CardVerificationAvs = "pending"
)

type CardVerificationCvv

type CardVerificationCvv string

CardVerificationCvv contains the cvv value for the card verification.

const (
	// CardVerificationCvvNotRequested = "not_requested".
	CardVerificationCvvNotRequested CardVerificationCvv = "not_requested"

	// CardVerificationCvvPass = "pass".
	CardVerificationCvvPass CardVerificationCvv = "pass"

	// CardVerificationCvvFail = "fail".
	CardVerificationCvvFail CardVerificationCvv = "fail"

	// CardVerificationCvvUnavailable = "unavailable".
	CardVerificationCvvUnavailable CardVerificationCvv = "unavailable"

	// CardVerificationCvvPending = "pending".
	CardVerificationCvvPending CardVerificationCvv = "pending"
)

type ChargeBack

type ChargeBack struct {
	// Unique system generated identifier for the payment item.
	ID string `json:"id,omitempty"`

	// Unique system generated identifier for the payment that is associated to the chargeback item.
	PaymentID string `json:"paymentId,omitempty"`

	// Unique system generated identifier for the merchant.
	MerchantID string `json:"merchantId,omitempty"`

	// Reason code given by the card network for the chargeback item.
	ReasonCode string `json:"reasonCode,omitempty"`

	// Enumerated category of the chargeback status codes based on the chargeback status code.
	// options: Canceled Recurring Payment,  Customer Dispute, Fraudulent, General, Processing Error, Not Defined
	Category ChargeBackCategory `json:"category,omitempty"`

	// The chargeback item's history list will be sorted by create date descending:
	// more recent chargeback statuses will be at the beginning of the list.
	History []ChargeBackHistory `json:"history,omitempty"`
}

ChargeBack is the object contain the chargeback data returned from the API.

type ChargeBackCategory

type ChargeBackCategory string

ChargeBackCategory contains the category value for the charge back.

const (
	// ChargeBackCategoryCanceledRecurringPayment = "Canceled Recurring Payment".
	ChargeBackCategoryCanceledRecurringPayment ChargeBackCategory = "Canceled Recurring Payment"

	// ChargeBackCategoryCustomerDispute = "Customer Dispute".
	ChargeBackCategoryCustomerDispute ChargeBackCategory = "Customer Dispute"

	// ChargeBackCategoryFraudulent = "Fraudulent".
	ChargeBackCategoryFraudulent ChargeBackCategory = "Fraudulent"

	// ChargeBackCategoryGeneral = "General".
	ChargeBackCategoryGeneral ChargeBackCategory = "General"

	// ChargeBackCategoryProcessingError = "Processing Error".
	ChargeBackCategoryProcessingError ChargeBackCategory = "Processing Error"

	// ChargeBackCategoryNotDefined = "Not Defined".
	ChargeBackCategoryNotDefined ChargeBackCategory = "Not Defined"
)

type ChargeBackHistory

type ChargeBackHistory struct {
	// Enumerated type of the chargeback history event. 1st Chargeback represents the first stage of the dispute
	// procedure initiated by the cardholder’s issuing bank.  2nd Chargeback represents the second stage of the
	// dispute procedure initiated by the cardholder’s issuing bank (This stage is MasterCard only).
	// Chargeback Reversal represents when 1st Chargeback or 2nd Chargeback is withdrawn by the issuer.
	// Representment represents the stage when merchants decided to dispute 1st Chargeback or 2nd Chargeback.
	//Chargeback Settlement can imply one of the two: 1) If merchant or marketplace is taking the lost of the
	// chargeback, money will be debit from the wallet during this stage.
	//If merchant of marketplace successfully dispute the chargeback, money will be credit back to the wallet
	// during this stage.
	//1st Chargeback, 2nd Chargeback, Chargeback Reversal, Representment, Chargeback Settlement
	Type ChargeBackHistoryType `json:"type,omitempty"`

	// Chargeback amount object for the history
	ChargeBackAmount *Amount `json:"chargeBackAmount,omitempty"`

	// Fee object for the history
	Fee *Amount `json:"fee,omitempty"`

	// The reason the chargeback was created.
	Description string `json:"description,omitempty"`

	// Unique system generated identifier for the settlement related to the chargeback history.
	SettlementID string `json:"settlementId,omitempty"`

	// ISO-8601 UTC date/time format of the history creation date.
	CreateDate string `json:"createDate,omitempty"`
}

ChargeBackHistory contains the data for one item of the chargeback object history property.

type ChargeBackHistoryType

type ChargeBackHistoryType string

ChargeBackHistoryType contains the type value for the charge back history.

const (
	// ChargeBackHistoryType1stChargeBack = "1st Chargeback".
	ChargeBackHistoryType1stChargeBack ChargeBackHistoryType = "1st Chargeback"

	// ChargeBackHistoryType2ndChargeBack = "2nd Chargeback".
	ChargeBackHistoryType2ndChargeBack ChargeBackHistoryType = "2nd Chargeback"

	// ChargeBackHistoryTypeChargeBackReversal = "Chargeback Reversal".
	ChargeBackHistoryTypeChargeBackReversal ChargeBackHistoryType = "Chargeback Reversal"

	// ChargeBackHistoryTypeRepresentment = "Representment".
	ChargeBackHistoryTypeRepresentment ChargeBackHistoryType = "Representment"

	// ChargeBackHistoryTypeChargeBackSettlement = "Chargeback Settlement".
	ChargeBackHistoryTypeChargeBackSettlement ChargeBackHistoryType = "Chargeback Settlement"
)

type Client

type Client struct {
	// User agent value to report to the service.
	UserAgent string

	// Time to maintain open the connection with the service, in seconds.
	KeepAlive uint

	// Maximum network connections to keep open with the service.
	MaxConnections uint

	// Network transport used to communicate with the service.
	Conn *http.Client

	// Time to wait for requests, in seconds.
	Timeout uint

	// Circle API key.
	Key string

	// Produce trace output of requests and responses.
	Debug bool

	// API backend to use.
	Backend string
}

Client contains the properties of the connection.

func NewClient

func NewClient(options ...Option) (*Client, error)

NewClient will construct a usable service handler using the provided API key and configuration options, if 'nil' options are provided default sane values will be used.

func (*Client) Dispatch

func (cl *Client) Dispatch(r *RequestOptions) error

Dispatch a network request to the service.

type CreateBankAccountRequest

type CreateBankAccountRequest struct {
	// Universally unique identifier (UUID v4) idempotency key.
	// This key is utilized to ensure exactly-once execution of mutating requests.
	IdempotencyKey string `json:"idempotencyKey,omitempty"`

	// The token for the ACH account provided by the processor (Plaid).
	PlaidProcessorToken string `json:"plaidProcessorToken,omitempty"`

	// Billing details of the account holder.
	BillingDetails *BillingDetails `json:"billingDetails,omitempty"`

	// Object containing metadata for the bank account creation process
	Metadata *CreateMetadataRequest `json:"metadata,omitempty"`
}

CreateBankAccountRequest contains the data to create a bank account (ACH).

type CreateCardRequest

type CreateCardRequest struct {
	// Universally unique identifier (UUID v4) idempotency key.
	// This key is utilized to ensure exactly-once execution of mutating requests.
	IdempotencyKey string `json:"idempotencyKey,omitempty"`

	// Universally unique identifier (UUID v4) of the public key used in encryption.
	// NOTE the sandbox environment uses the default value of key1.
	// For this reason the example supplied is key1 rather than a UUID.
	KeyID string `json:"keyId,omitempty"`

	// PGP encrypted base64 encoded string. Contains Number and CVV.
	EncryptedData string `json:"encryptedData,omitempty"`

	// Object containing billing details for the card.
	BillingDetails *BillingDetails `json:"billingDetails,omitempty"`

	// Two digit number representing the card's expiration month.
	ExpMonth int `json:"expMonth,omitempty"`

	// Four digit number representing the card's expiration year.
	ExpYear int `json:"expYear,omitempty"`

	// Object containing metadata for the card creation process
	Metadata *CreateMetadataRequest `json:"metadata,omitempty"`
}

CreateCardRequest contains the data to create a card.

type CreateMetadataRequest

type CreateMetadataRequest struct {
	// Email of the user.
	Email string `json:"email,omitempty"`

	// Phone number of the user in E.164 format.
	// We recommend using a library such as libphonenumber to parse and validate phone numbers.
	PhoneNumber string `json:"phoneNumber,omitempty"`

	// Hash of the session identifier; typically of the end user.
	// This helps us make risk decisions and prevent fraud.
	// IMPORTANT: Please hash the session identifier to prevent sending us actual session identifiers.
	SessionID string `json:"sessionId,omitempty"`

	// Single IPv4 or IPv6 address of user.
	IPAddress string `json:"ipAddress,omitempty"`
}

CreateMetadataRequest contains the data to create metadata for entities.

type CreatePaymentRequest

type CreatePaymentRequest struct {
	// Universally unique identifier (UUID v4) idempotency key.
	// This key is utilized to ensure exactly-once execution of mutating requests.
	IdempotencyKey string `json:"idempotencyKey,omitempty"`

	// Universally unique identifier (UUID v4) of the public key used in encryption.
	// NOTE the sandbox environment uses the default value of key1.
	// For this reason the example supplied is key1 rather than a UUID.
	KeyID string `json:"keyId,omitempty"`

	// Object containing metadata for the payment creation process
	Metadata *CreateMetadataRequest `json:"metadata,omitempty"`

	// Amount object for the payment
	Amount *Amount `json:"amount,omitempty"`

	// Triggers the automatic capture of the full payment amount.
	// If set to false the payment will only be authorized but not captured.
	AutoCapture bool `json:"autoCapture"`

	// Indicates the verification method for this payment.
	Verification string `json:"verification,omitempty"`

	// The URL to redirect users to after successful 3DS authentication.
	VerificationSuccessURL string `json:"verificationSuccessUrl,omitempty"`

	// The URL to redirect users to after failed 3DS authentication.
	VerificationFailureURL string `json:"verificationFailureUrl,omitempty"`

	// Source object used for the payment
	Source *Source `json:"source,omitempty"`

	// Description of the payment with length restriction of 240 characters.
	Description string `json:"description,omitempty"`

	// PGP encrypted base64 encoded string. Contains CVV.
	EncryptedData string `json:"encryptedData,omitempty"`

	// The channel identifier that can be set for the payment. When not provided, the default channel is used.
	Channel string `json:"channel,omitempty"`
}

CreatePaymentRequest contains the data to create a payment.

type CreatePayoutMetadataRequest

type CreatePayoutMetadataRequest struct {
	// Email of the user.
	BeneficiaryEmail string `json:"beneficiaryEmail,omitempty"`
}

CreatePayoutMetadataRequest contains data related to the payout beneficiary.

type CreatePayoutRequest

type CreatePayoutRequest struct {
	// Universally unique identifier (UUID v4) idempotency key.
	// This key is utilized to ensure exactly-once execution of mutating requests.
	IdempotencyKey string `json:"idempotencyKey,omitempty"`

	// Source object for the payout
	Source *Source `json:"source,omitempty"`

	// The destination bank account.
	PayoutDestination *Source `json:"payoutDestination,omitempty"`

	// Amount object for the payout
	Amount *Amount `json:"amount,omitempty"`

	// Additional properties related to the payout beneficiary.
	Metadata *CreatePayoutMetadataRequest `json:"metadata,omitempty"`
}

CreatePayoutRequest contains the data to create a payout.

type DepositAddress

type DepositAddress struct {
	// Entity identifier. Numeric value but should be treated as a string as
	// format may change in the future
	ID string `json:"id,omitempty"`

	// Entity type.
	Kind string `json:"type,omitempty"`

	// An alphanumeric string representing a blockchain address. Will be in
	// different formats for different chains. It is important to preserve the
	// exact formatting and capitalization of the address.
	Address string `json:"address,omitempty"`

	// The secondary identifier for a blockchain address. An example of this is
	// the memo field on the Stellar network, which can be text, id, or hash format.
	AddressTag string `json:"addressTag,omitempty"`

	// Currency associated with a balance or address.
	Currency string `json:"currency,omitempty"`

	// Blockchain that a given currency is available on.
	Chain string `json:"chain,omitempty"`

	// An identifier or sentence that describes the recipient.
	Description string `json:"description,omitempty"`
}

DepositAddress represents a blockchain account/destination where a user is available to receive funds.

type Error

type Error struct {
	// General error type.
	// https://developers.circle.com/docs/api-response-errors
	Code int `json:"code,omitempty"`

	// Human-friendly message.
	Message string `json:"message,omitempty"`

	// Additional error details.
	// https://developers.circle.com/docs/entity-errors
	Details []ExtendedErrorDetails `json:"errors,omitempty"`
}

Error details for unsuccessful API requests. https://developers.circle.com/docs/common-error-responses

func (*Error) Error

func (e *Error) Error() string

type ErrorConstraints

type ErrorConstraints struct {
	// Used to describe `max_value` or `min_value` errors.
	Min string `json:"min,omitempty"`

	// Used to describe `max_value` or `min_value` errors.
	Max string `json:"max,omitempty"`

	// Used to describe `max_value` or `min_value` errors.
	Inclusive bool `json:"inclusive,omitempty"`

	// Used to describe `pattern_mismatch` errors.
	Pattern string `json:"pattern,omitempty"`

	// Used to describe `number_format` errors.
	MaxIntegralDigits int `json:"max-integral-digits,omitempty"`

	// Used to described `number_format` errors.
	MaxFractionalDigits int `json:"max-fractional-digits,omitempty"`
}

ErrorConstraints contains additional details about the error and could be used for programmatic handling on the client side.

type ExtendedErrorDetails

type ExtendedErrorDetails struct {
	// Type of an error
	ErrorType string `json:"error,omitempty"`

	// Human-friendly message
	Message string `json:"message,omitempty"`

	// Period-separated path to the property that causes this error.
	// For example: address.billingCountry
	Location string `json:"location,omitempty"`

	// Actual value of the property specified in location key, as
	// received by the server.
	InvalidValue string `json:"invalidValue,omitempty"`

	// Special object that contains additional details about the error
	// and could be used for programmatic handling on the client side.
	Constraints ErrorConstraints `json:"constraints,omitempty"`
}

ExtendedErrorDetails contains a list of one or multiple error descriptions associated with it.

type ListPaymentsRequest

type ListPaymentsRequest struct {
	// Universally unique identifier (UUID v4) for the source.
	// Filter results to fetch only payments made from the provided source.
	Source string `json:"source,omitempty"`

	// Queries items with the specified settlement id. Matches any settlement id if unspecified.
	SettlementID string `json:"settlementId,omitempty"`

	// Source account type. Filters the results to fetch all payments made from a specified account type.
	// Matches any source type if unspecified.
	Type []string `json:"type,omitempty"`

	// Queries items with the specified status. Matches any status if unspecified.
	Status PaymentStatus `json:"status,omitempty"`
}

ListPaymentsRequest contains the data to list payments.

type ListPayoutsRequest

type ListPayoutsRequest struct {
	// Universally unique identifier (UUID v4) for the source wallet. Filters the results
	// to fetch all payouts made from a source wallet. If not provided,
	// payouts from all wallets will be returned.
	Source string `json:"source,omitempty"`

	// Destination bank account type. Filters the results to fetch all payouts made to a specified
	// destination bank account type. This query parameter can be passed multiple times to fetch results
	// matching multiple destination bank account types.
	Type []string `json:"type,omitempty"`

	// Queries items with the specified status. Matches any status if unspecified.
	Status []PayoutStatus `json:"status,omitempty"`

	// Universally unique identifier (UUID v4) for the destination bank account.
	// Filters the results to fetch all payouts made to a destination bank account.
	Destination string `json:"destination,omitempty"`
}

ListPayoutsRequest contains the data to list payouts.

type Metadata

type Metadata struct {
	// Email of the user.
	Email string `json:"email,omitempty"`

	// Phone number of the user in E.164 format.
	// We recommend using a library such as libphonenumber to parse and validate phone numbers.
	PhoneNumber string `json:"phoneNumber,omitempty"`
}

Metadata is the object containing metadata for the entity.

type Option

type Option func(*Client) error

Option settings allow you to customize the behavior of a client instance.

func WithAPIKey

func WithAPIKey(key string) Option

WithAPIKey specifies the Circle API key used to access the service.

func WithAPIKeyFromEnv

func WithAPIKeyFromEnv(name string) Option

WithAPIKeyFromEnv loads the Circle API key from the ENV variable specified in 'name'.

func WithDebug

func WithDebug() Option

WithDebug makes the client produce trace output of requests and responses. Recommended only for testing and development.

func WithKeepAlive

func WithKeepAlive(val uint) Option

WithKeepAlive adjust the time to maintain open the connection with the service, in seconds.

func WithMaxConnections

func WithMaxConnections(val uint) Option

WithMaxConnections adjusts the maximum number of network connections to keep open with the service.

func WithProductionBackend

func WithProductionBackend() Option

WithProductionBackend adjust the client to consume the production API. If not specified, the client will submit requests to the sandbox environment by default.

func WithTimeout

func WithTimeout(val uint) Option

WithTimeout specifies a time limit for requests made by this client. The timeout includes connection time, any redirects, and reading the response body. A timeout of zero means no timeout.

func WithUserAgent

func WithUserAgent(agent string) Option

WithUserAgent adjust the network agent value reported to the service.

type Payment

type Payment struct {
	// Unique system generated identifier for the payment item.
	ID string `json:"id,omitempty"`

	// Type of the payment object.
	// options: payment, refund, cancel
	Type PaymentType `json:"type"`

	// Unique system generated identifier for the merchant.
	MerchantID string `json:"merchantId"`

	// Unique system generated identifier for the wallet of the merchant.
	MerchantWalletID string `json:"merchantWalletId"`

	// Amount object for the payment
	Amount *Amount `json:"amount,omitempty"`

	// The payment source.
	Source *Source `json:"source,omitempty"`

	// Enumerated description of the payment.
	Description string `json:"description,omitempty"`

	// Enumerated status of the payment.
	// pending means the payment is waiting to be processed.
	// confirmed means the payment has been approved by the bank and the merchant can treat it as successful,
	// but settlement funds are not yet available to the merchant.
	// paid means settlement funds have been received and are available to the merchant.
	// failed means something went wrong (most commonly that the payment was denied).
	// action_required means that additional steps are required to process this payment;
	// refer to requiredAction for more details.
	// Terminal states are paid and failed.
	Status PaymentStatus `json:"status,omitempty"`

	// Determines if a payment has successfully been captured.
	// This property is only present for payments that did not use auto capture.
	Captured *bool `json:"captured,omitempty"`

	CaptureAmount *Amount `json:"captureAmount,omitempty"`

	// ISO-8601 UTC date/time format.
	CaptureDate string `json:"captureDate,omitempty"`

	// When the payment status is action_required, this object summarizes the required additional steps.
	RequiredAction *RequiredAction `json:"requiredAction,omitempty"`

	// Indicates the status of the payment verification. This property will be present once the payment is confirmed.
	Verification *PaymentVerification `json:"verification,omitempty"`

	// Fees object for the payment
	Fees *Amount `json:"fees,omitempty"`

	// Payment tracking reference. Will be present once known.
	TrackingRef string `json:"trackingRef,omitempty"`

	// External network identifier which will be present once provided from the applicable network.
	ExternalRef string `json:"externalRef,omitempty"`

	// Indicates the failure reason of a payment. Only present for payments in failed state.
	// Possible values are [payment_failed, payment_fraud_detected, payment_denied,
	// payment_not_supported_by_issuer, payment_not_funded, payment_unprocessable,
	// payment_stopped_by_issuer, payment_canceled, payment_returned, payment_failed_balance_check,
	// card_failed, card_invalid, card_address_mismatch, card_zip_mismatch, card_cvv_invalid,
	// card_expired, card_limit_violated, card_not_honored, card_cvv_required, credit_card_not_allowed,
	// card_account_ineligible, card_network_unsupported, channel_invalid, unauthorized_transaction,
	// bank_account_ineligible, bank_transaction_error, invalid_account_number, invalid_wire_rtn,
	// invalid_ach_rtn, vendor_inactive]'
	ErrorCode PaymentErrorCode `json:"errorCode,omitempty"`

	// Object containing metadata for the payment
	Metadata *Metadata `json:"metadata,omitempty"`

	// Results of risk evaluation. Only present if the payment is denied by Circle's risk service.
	RiskEvaluation *RiskEvaluation `json:"riskEvaluation,omitempty"`

	// The channel identifier that can be set for the payment. When not provided, the default channel is used.
	Channel string `json:"channel,omitempty"`

	// ISO-8601 UTC date/time format of the payment creation date.
	CreateDate string `json:"createDate,omitempty"`

	// ISO-8601 UTC date/time format of the payment update date.
	UpdateDate string `json:"updateDate,omitempty"`

	// Status information of the related cancel. This property is only present on canceled payment or refund items.
	Cancel *Payment `json:"cancel,omitempty"`

	// Status information of the related payment. This property is only present on refund or cancel items.
	OriginalPayment *Payment `json:"originalPayment,omitempty"`

	// Array of refunded payments.
	Refunds []Payment `json:"refunds,omitempty"`
}

Payment is the object contain the payment data returned from the API.

type PaymentErrorCode

type PaymentErrorCode string

PaymentErrorCode contains the error code value for the payment.

const (
	// PaymentErrorCodePaymentFailed = "payment_failed".
	PaymentErrorCodePaymentFailed PaymentErrorCode = "payment_failed"

	// PaymentErrorCodePaymentFraudDetected = "payment_fraud_detected".
	PaymentErrorCodePaymentFraudDetected PaymentErrorCode = "payment_fraud_detected"

	// PaymentErrorCodePaymentDenied = "payment_denied".
	PaymentErrorCodePaymentDenied PaymentErrorCode = "payment_denied"

	// PaymentErrorCodePaymentNotSupportedByIssuer = "payment_not_supported_by_issuer".
	PaymentErrorCodePaymentNotSupportedByIssuer PaymentErrorCode = "payment_not_supported_by_issuer"

	// PaymentErrorCodePaymentNotFound = "payment_not_funded".
	PaymentErrorCodePaymentNotFound PaymentErrorCode = "payment_not_funded"

	// PaymentErrorCodePaymentUnprocessable = "payment_unprocessable".
	PaymentErrorCodePaymentUnprocessable PaymentErrorCode = "payment_unprocessable"

	// PaymentErrorCodePaymentStoppedByIssuer = "payment_stopped_by_issuer".
	PaymentErrorCodePaymentStoppedByIssuer PaymentErrorCode = "payment_stopped_by_issuer"

	// PaymentErrorCodePaymentCanceled = "payment_canceled".
	PaymentErrorCodePaymentCanceled PaymentErrorCode = "payment_canceled"

	// PaymentErrorCodePaymentReturned = "payment_returned".
	PaymentErrorCodePaymentReturned PaymentErrorCode = "payment_returned"

	// PaymentErrorCodePaymentFailedBalanceCheck = "payment_failed_balance_check".
	PaymentErrorCodePaymentFailedBalanceCheck PaymentErrorCode = "payment_failed_balance_check"

	// PaymentErrorCodeCardFailed = "card_failed".
	PaymentErrorCodeCardFailed PaymentErrorCode = "card_failed"

	// PaymentErrorCodeCardInvalid = "card_invalid".
	PaymentErrorCodeCardInvalid PaymentErrorCode = "card_invalid"

	// PaymentErrorCodeCardAddressMismatch = "card_address_mismatch".
	PaymentErrorCodeCardAddressMismatch PaymentErrorCode = "card_address_mismatch"

	// PaymentErrorCodeCardZipMismatch = "card_zip_mismatch".
	PaymentErrorCodeCardZipMismatch PaymentErrorCode = "card_zip_mismatch"

	// PaymentErrorCodeCardCvvInvalid = "card_cvv_invalid".
	PaymentErrorCodeCardCvvInvalid PaymentErrorCode = "card_cvv_invalid"

	// PaymentErrorCodeCardExpired = "card_expired".
	PaymentErrorCodeCardExpired PaymentErrorCode = "card_expired"

	// PaymentErrorCodeCardLimitViolated = "card_limit_violated".
	PaymentErrorCodeCardLimitViolated PaymentErrorCode = "card_limit_violated"

	// PaymentErrorCodeCardNotHonored = "card_not_honored".
	PaymentErrorCodeCardNotHonored PaymentErrorCode = "card_not_honored"

	// PaymentErrorCodeCardCvvRequired = "card_cvv_required".
	PaymentErrorCodeCardCvvRequired PaymentErrorCode = "card_cvv_required"

	// PaymentErrorCodeCreditCardNotAllowed = "credit_card_not_allowed".
	PaymentErrorCodeCreditCardNotAllowed PaymentErrorCode = "credit_card_not_allowed"

	// PaymentErrorCodeCardAccountIneligible = "card_account_ineligible".
	PaymentErrorCodeCardAccountIneligible PaymentErrorCode = "card_account_ineligible"

	// PaymentErrorCodeCardNetworkUnsupported = "card_network_unsupported".
	PaymentErrorCodeCardNetworkUnsupported PaymentErrorCode = "card_network_unsupported"

	// PaymentErrorCodeChannelInvalid = "channel_invalid".
	PaymentErrorCodeChannelInvalid PaymentErrorCode = "channel_invalid"

	// PaymentErrorCodeUnauthorized = "unauthorized_transaction".
	PaymentErrorCodeUnauthorized PaymentErrorCode = "unauthorized_transaction"

	// PaymentErrorCodeBankAccountIneligible = "bank_account_ineligible".
	PaymentErrorCodeBankAccountIneligible PaymentErrorCode = "bank_account_ineligible"

	// PaymentErrorCodeBankTransactionError = "bank_transaction_error".
	PaymentErrorCodeBankTransactionError PaymentErrorCode = "bank_transaction_error"

	// PaymentErrorCodeInvalidAccountNumber = "invalid_account_number".
	PaymentErrorCodeInvalidAccountNumber PaymentErrorCode = "invalid_account_number"

	// PaymentErrorCodeInvalidWireRtn = "invalid_wire_rtn".
	PaymentErrorCodeInvalidWireRtn PaymentErrorCode = "invalid_wire_rtn"

	// PaymentErrorCodeInvalidAchRtn = "invalid_ach_rtn".
	PaymentErrorCodeInvalidAchRtn PaymentErrorCode = "invalid_ach_rtn"

	// PaymentErrorCodeVendorInactive = "vendor_inactive".
	PaymentErrorCodeVendorInactive PaymentErrorCode = "vendor_inactive"
)

type PaymentStatus

type PaymentStatus string

PaymentStatus contains the status value for the payment.

const (
	// PaymentStatusPending = "pending".
	PaymentStatusPending PaymentStatus = "pending"

	// PaymentStatusConfirmed = "confirmed".
	PaymentStatusConfirmed PaymentStatus = "confirmed"

	// PaymentStatusPaid = "paid".
	PaymentStatusPaid PaymentStatus = "paid"

	// PaymentStatusFailed = "failed".
	PaymentStatusFailed PaymentStatus = "failed"

	// PaymentStatusActionRequired = "action_required".
	PaymentStatusActionRequired PaymentStatus = "action_required"
)

type PaymentType

type PaymentType string

PaymentType contains the type value for the payment.

const (
	// PaymentTypePayment = "payment".
	PaymentTypePayment PaymentType = "payment"

	// PaymentTypeRefund = "refund".
	PaymentTypeRefund PaymentType = "refund"

	// PaymentTypeCancel = "cancel".
	PaymentTypeCancel PaymentType = "cancel"
)

type PaymentVerification

type PaymentVerification struct {
	// Status of the AVS check. Raw AVS response, expressed as an upper-case letter.
	// not_requested indicates check was not made.
	// pending is pending/processing.
	Avs PaymentVerificationAvs `json:"avs,omitempty"`

	// Enumerated status of the check.
	// not_requested indicates check was not made.
	// pass indicates value is correct.
	// fail indicates value is incorrect.
	// unavailable indicates card issuer did not do the provided check.
	// pending indicates check is pending/processing.
	Cvv PaymentVerificationCvv `json:"cvv,omitempty"`

	// Enumerated status of the check.
	// pass indicates successful 3DS authentication.
	// fail indicates failed 3DS authentication.
	ThreeDSecure PaymentVerificationThreeDSecure `json:"threeDSecure"`

	// ECI (electronic commerce indicator) value returned by Directory Servers
	// (namely Visa, MasterCard, JCB, and American Express) indicating the outcome
	// of authentication attempted on transactions enforced by 3DS.
	Eci PaymentVerificationEci `json:"eci,omitempty"`
}

PaymentVerification indicates the status of the payment verification. This property will be present once the payment is confirmed.

type PaymentVerificationAvs

type PaymentVerificationAvs string

PaymentVerificationAvs contains the avs value for the payment verification.

const (
	// PaymentVerificationAvsNotRequested = "not_requested".
	PaymentVerificationAvsNotRequested PaymentVerificationAvs = "not_requested"

	// PaymentVerificationAvsPending = "pending".
	PaymentVerificationAvsPending PaymentVerificationAvs = "pending"
)

type PaymentVerificationCvv

type PaymentVerificationCvv string

PaymentVerificationCvv contains the cvv value for the payment verification.

const (
	// PaymentVerificationCvvNotRequested = "not_requested".
	PaymentVerificationCvvNotRequested PaymentVerificationCvv = "not_requested"

	// PaymentVerificationCvvPass = "pass".
	PaymentVerificationCvvPass PaymentVerificationCvv = "pass"

	// PaymentVerificationCvvFail = "fail".
	PaymentVerificationCvvFail PaymentVerificationCvv = "fail"

	// PaymentVerificationCvvUnavailable = "unavailable".
	PaymentVerificationCvvUnavailable PaymentVerificationCvv = "unavailable"

	// PaymentVerificationCvvPending = "pending".
	PaymentVerificationCvvPending PaymentVerificationCvv = "pending"
)

type PaymentVerificationEci

type PaymentVerificationEci string

PaymentVerificationEci contains the eci value for the payment verification.

const (
	// PaymentVerificationEci00 = "00".
	PaymentVerificationEci00 PaymentVerificationEci = "00"

	// PaymentVerificationEci01 = "01".
	PaymentVerificationEci01 PaymentVerificationEci = "01"

	// PaymentVerificationEci02 = "02".
	PaymentVerificationEci02 PaymentVerificationEci = "02"

	// PaymentVerificationEci05 = "05".
	PaymentVerificationEci05 PaymentVerificationEci = "05"

	// PaymentVerificationEci06 = "06".
	PaymentVerificationEci06 PaymentVerificationEci = "06"

	// PaymentVerificationEci07 = "07".
	PaymentVerificationEci07 PaymentVerificationEci = "07"
)

type PaymentVerificationThreeDSecure

type PaymentVerificationThreeDSecure string

PaymentVerificationThreeDSecure contains the three d secure value for the payment verification.

const (
	//PaymentVerificationThreeDSecurePass = "pass".
	PaymentVerificationThreeDSecurePass PaymentVerificationThreeDSecure = "pass"

	// PaymentVerificationThreeDSecureFail = "fail".
	PaymentVerificationThreeDSecureFail PaymentVerificationThreeDSecure = "fail"
)

type Payout

type Payout struct {
	// Unique system generated identifier for the payment item.
	ID string `json:"id,omitempty"`

	// The identifier of the source wallet used to fund a payout.
	SourceWalletID string `json:"sourceWalletId,omitempty"`

	// The destination bank account.
	Destination *PayoutDestination `json:"destination,omitempty"`

	// Amount object for the payout
	Amount *Amount `json:"amount,omitempty"`

	// Fees object for the payout
	Fees *Amount `json:"fees,omitempty"`

	// Status of the payout. Status pending indicates that the payout is in process;
	// complete indicates it finished successfully;
	// failed indicates it failed.
	Status PayoutStatus `json:"status,omitempty"`

	// A payout tracking reference. Will be present once known.
	TrackingRef string `json:"trackingRef,omitempty"`

	// External network identifier which will be present once provided from the applicable network.
	ExternalRef string `json:"externalRef,omitempty"`

	// Indicates the failure reason of a payout. Only present for payouts in failed state.
	// Possible values are [insufficient_funds, transaction_denied, transaction_failed,
	// transaction_returned, bank_transaction_error, fiat_account_limit_exceeded, invalid_bank_account_number,
	// invalid_ach_rtn, invalid_wire_rtn, vendor_inactive]'.
	ErrorCode PayoutErrorCode `json:"errorCode,omitempty"`

	// Results of risk evaluation. Only present if the payment is denied by Circle's risk service.
	RiskEvaluation *RiskEvaluation `json:"riskEvaluation,omitempty"`

	// Final adjustment which increases (credits) or decreases (debits) the total returned amount to the source wallet.
	Adjustments *PayoutAdjustment `json:"adjustments,omitempty"`

	// Return information if the payout is returned by bank.
	// Only present if errorCode of payout is transaction_returned.
	Return *PayoutReturn `json:"return,omitempty"`

	// ISO-8601 UTC date/time format of the payout creation date.
	CreateDate string `json:"createDate,omitempty"`

	// ISO-8601 UTC date/time format of the payout update date.
	UpdateDate string `json:"updateDate,omitempty"`
}

Payout is the object contain the payout data returned from the API.

type PayoutAdjustment

type PayoutAdjustment struct {
	// Credit object for the adjustment
	FxCredit *Amount `json:"fxCredit,omitempty"`

	// Debit object for the adjustment
	FxDebit *Amount `json:"fxDebit,omitempty"`
}

PayoutAdjustment contains information about increases (credits) or decreases (debits) the total returned amount to the source wallet.

type PayoutDestination

type PayoutDestination struct {
	// Unique system generated identifier for the payment item.
	ID string `json:"id,omitempty"`

	// The destination bank account type.
	// options: wire, ach, sepa
	Type PayoutDestinationType `json:"type,omitempty"`

	// Bank name plus last four digits of the bank account number or IBAN.
	Name string `json:"name,omitempty"`
}

PayoutDestination contains the bank account details.

type PayoutDestinationType

type PayoutDestinationType string

PayoutDestinationType contains the type value for the payout destination.

const (
	// PayoutDestinationTypeWire = "wire".
	PayoutDestinationTypeWire PayoutDestinationType = "wire"

	// PayoutDestinationTypeAch = "ach".
	PayoutDestinationTypeAch PayoutDestinationType = "ach"

	// PayoutDestinationTypeSepa = "sepa".
	PayoutDestinationTypeSepa PayoutDestinationType = "sepa"
)

type PayoutErrorCode

type PayoutErrorCode string

PayoutErrorCode contains the error code value for the payout.

const (
	// PayoutErrorCodeInsufficientFunds = "insufficient_funds".
	PayoutErrorCodeInsufficientFunds PayoutErrorCode = "insufficient_funds"

	// PayoutErrorCodeTransactionDenied = "transaction_denied".
	PayoutErrorCodeTransactionDenied PayoutErrorCode = "transaction_denied"

	// PayoutErrorCodeTransactionFailed = "transaction_failed".
	PayoutErrorCodeTransactionFailed PayoutErrorCode = "transaction_failed"

	// PayoutErrorCodeTransactionReturned = "transaction_returned".
	PayoutErrorCodeTransactionReturned PayoutErrorCode = "transaction_returned"

	// PayoutErrorCodeBankTransactionError = "bank_transaction_error".
	PayoutErrorCodeBankTransactionError PayoutErrorCode = "bank_transaction_error"

	// PayoutErrorCodeFiatAccountLimitExceed = "fiat_account_limit_exceeded".
	PayoutErrorCodeFiatAccountLimitExceed PayoutErrorCode = "fiat_account_limit_exceeded"

	// PayoutErrorCodeInvalidBankAccountNumber = "invalid_bank_account_number".
	PayoutErrorCodeInvalidBankAccountNumber PayoutErrorCode = "invalid_bank_account_number"

	// PayoutErrorCodeInvalidAchRtn = "invalid_ach_rtn".
	PayoutErrorCodeInvalidAchRtn PayoutErrorCode = "invalid_ach_rtn"

	// PayoutErrorCodeInvalidWireRtn = "invalid_wire_rtn".
	PayoutErrorCodeInvalidWireRtn PayoutErrorCode = "invalid_wire_rtn"

	// PayoutErrorCodeVendorInactive = "vendor_inactive".
	PayoutErrorCodeVendorInactive PayoutErrorCode = "vendor_inactive"
)

type PayoutReturn

type PayoutReturn struct {
	// Unique system generated identifier for the payment item.
	ID string `json:"id,omitempty"`

	// Universally unique identifier (UUID v4) of the payout that is associated with the return.
	PayoutID string `json:"payoutId,omitempty"`

	// Amount object for the return
	Amount *Amount `json:"amount,omitempty"`

	// Fees object for the return
	Fees *Amount `json:"fees,omitempty"`

	// Reason for the return.
	Reason string `json:"reason,omitempty"`

	// Status of the return. A pending status indicates that the return is in process;
	// complete indicates it finished successfully;
	// failed indicates it failed.
	Status PayoutReturnStatus `json:"status,omitempty"`

	// ISO-8601 UTC date/time format of the return creation date.
	CreateDate string `json:"createDate,omitempty"`

	// ISO-8601 UTC date/time format of the return update date.
	UpdateDate string `json:"updateDate,omitempty"`
}

PayoutReturn contains data if the payout is returned by the bank.

type PayoutReturnStatus

type PayoutReturnStatus string

PayoutReturnStatus contains the status value for the payout return.

const (
	// PayoutReturnStatusPending = "pending".
	PayoutReturnStatusPending PayoutReturnStatus = "pending"

	// PayoutReturnStatusComplete = "complete".
	PayoutReturnStatusComplete PayoutReturnStatus = "complete"

	//PayoutReturnStatusFailed = "failed".
	PayoutReturnStatusFailed PayoutReturnStatus = "failed"
)

type PayoutStatus

type PayoutStatus string

PayoutStatus contains the status value for the payout.

const (
	// PayoutStatusPending = "pending".
	PayoutStatusPending PayoutStatus = "pending"

	// PayoutStatusComplete = "complete".
	PayoutStatusComplete PayoutStatus = "complete"

	// PayoutStatusFailed = "failed".
	PayoutStatusFailed PayoutStatus = "failed"
)

type RefundPaymentRequest

type RefundPaymentRequest struct {
	// Universally unique identifier (UUID v4) idempotency key.
	// This key is utilized to ensure exactly-once execution of mutating requests.
	IdempotencyKey string `json:"idempotencyKey,omitempty"`

	// Amount object for the payment capture
	Amount *Amount `json:"amount,omitempty"`

	// Enumerated reason for a returned payment.
	// Providing this reason in the request is recommended (to improve risk evaluation) but not required.
	Reason string `json:"reason,omitempty"`
}

RefundPaymentRequest contains the data to refund a payment.

type RequestOptions

type RequestOptions struct {
	// HTTP method to use.
	Method string

	// API operation endpoint.
	Endpoint string

	// Operation parameters, if any.
	Input interface{}

	// Result holder, if any.
	Output interface{}

	// Automatically unwrap the "data" key in the response to the output
	// holder provided.
	UnwrapData bool

	// Produce idempotent results on POST requests; must be a valid UUID.
	// if none is provided a new one will be created by default.
	IdempotencyKey string

	// Custom request context.
	Ctx context.Context

	// Custom query parameters.
	QueryParams url.Values
}

RequestOptions represents network request options.

func (*RequestOptions) AddQueryParam

func (req *RequestOptions) AddQueryParam(key, value string)

AddQueryParam register a new query parameter.

type RequiredAction

type RequiredAction struct {
	// The type of action that is required to proceed with the payment. Currently only one type is supported.
	Type RequiredActionType `json:"type,omitempty"`

	// The URL to bring the user to in order to complete the payment.
	RedirectURL string `json:"redirectUrl,omitempty"`
}

RequiredAction indicates when the payment status is action_required, this object summarizes the required additional steps.

type RequiredActionType

type RequiredActionType string

RequiredActionType contains the type value for the required action.

const RequiredActionTypeThreeDSecureRequired RequiredActionType = "three_d_secure_required"

RequiredActionTypeThreeDSecureRequired = "three_d_secure_required".

type Reversal

type Reversal struct {
	// Unique system generated identifier for the payment item.
	ID string `json:"id,omitempty"`

	// Unique system generated identifier for the payment that is associated to the chargeback item.
	PaymentID string `json:"paymentId,omitempty"`

	// Amount object of the reversal
	Amount *Amount `json:"amount,omitempty"`

	// Enumerated description of the payment.
	Description string `json:"description,omitempty"`

	// Enumerated status of the payment. pending means the payment is waiting to be processed.
	// confirmed means the payment has been approved by the bank and the merchant can treat it as successful,
	// but settlement funds are not yet available to the merchant.
	// paid means settlement funds have been received and are available to the merchant.
	// failed means something went wrong (most commonly that the payment was denied).
	// Terminal states are paid and failed.
	Status ReversalStatus `json:"status,omitempty"`

	// Enumerated reason for a returned payment.
	// Providing this reason in the request is recommended (to improve risk evaluation) but not required.
	// options: duplicate, fraudulent, requested_by_customer, bank_transaction_error, invalid_account_number,
	// insufficient_funds, payment_stopped_by_issuer, payment_returned, bank_account_ineligible,
	// invalid_ach_rtn, unauthorized_transaction, payment_failed
	Reason ReversalReason `json:"reason,omitempty"`

	// Fees object for the reversal
	Fees *Amount `json:"fees,omitempty"`

	// ISO-8601 UTC date/time format of the reversal creation date.
	CreateDate string `json:"createDate,omitempty"`

	// ISO-8601 UTC date/time format of the reversal update date.
	UpdateDate string `json:"updateDate,omitempty"`
}

Reversal is the object contain the reversal data returned from the API.

type ReversalReason

type ReversalReason string

ReversalReason contains the reason value for the reversal.

const (
	// ReversalReasonDuplicate = "duplicate".
	ReversalReasonDuplicate ReversalReason = "duplicate"

	// ReversalReasonFraudulent = "fraudulent".
	ReversalReasonFraudulent ReversalReason = "fraudulent"

	// ReversalReasonRequestedByCustomer = "requested_by_customer".
	ReversalReasonRequestedByCustomer ReversalReason = "requested_by_customer"

	// ReversalReasonBankTransactionError = "bank_transaction_error".
	ReversalReasonBankTransactionError ReversalReason = "bank_transaction_error"

	// ReversalReasonInvalidAccountNumber = "invalid_account_number".
	ReversalReasonInvalidAccountNumber ReversalReason = "invalid_account_number"

	// ReversalReasonInsufficientFunds = "insufficient_funds".
	ReversalReasonInsufficientFunds ReversalReason = "insufficient_funds"

	// ReversalReasonPaymentStoppedByIssuer = "payment_stopped_by_issuer".
	ReversalReasonPaymentStoppedByIssuer ReversalReason = "payment_stopped_by_issuer"

	// ReversalReasonPaymentReturned = "payment_returned".
	ReversalReasonPaymentReturned ReversalReason = "payment_returned"

	// ReversalReasonBankAccountIneligible = "bank_account_ineligible".
	ReversalReasonBankAccountIneligible ReversalReason = "bank_account_ineligible"

	// ReversalReasonInvalidAchRtn = "invalid_ach_rtn".
	ReversalReasonInvalidAchRtn ReversalReason = "invalid_ach_rtn"

	// ReversalReasonUnauthorizedTransaction = "unauthorized_transaction".
	ReversalReasonUnauthorizedTransaction ReversalReason = "unauthorized_transaction"

	// ReversalReasonPaymentFailed = "payment_failed".
	ReversalReasonPaymentFailed ReversalReason = "payment_failed"
)

type ReversalStatus

type ReversalStatus string

ReversalStatus contains the status value for the reversal.

const (
	// ReversalStatusPending = "pending".
	ReversalStatusPending ReversalStatus = "pending"

	// ReversalStatusConfirmed = "confirmed".
	ReversalStatusConfirmed ReversalStatus = "confirmed"

	// ReversalStatusPaid = "paid".
	ReversalStatusPaid ReversalStatus = "paid"

	// ReversalStatusFailed = "failed".
	ReversalStatusFailed ReversalStatus = "failed"
)

type RiskEvaluation

type RiskEvaluation struct {
	// Enumerated decision of the account.
	// Options: approved, denied, review
	Decision RiskEvaluationDecision `json:"decision,omitempty"`

	// Risk reason for the definitive decision outcome.
	Reason string `json:"reason,omitempty"`
}

RiskEvaluation contains the Result of risk evaluation. Only present if the payment is denied by Circle's risk service.

type RiskEvaluationDecision

type RiskEvaluationDecision string

RiskEvaluationDecision contains decision value for the RiskEvaluation.

const (
	// RiskEvaluationDecisionApproved = "approved".
	RiskEvaluationDecisionApproved RiskEvaluationDecision = "approved"

	// RiskEvaluationDecisionDenied = "denied".
	RiskEvaluationDecisionDenied RiskEvaluationDecision = "denied"

	// RiskEvaluationDecisionReview = "review".
	RiskEvaluationDecisionReview RiskEvaluationDecision = "review"
)

type Settlement

type Settlement struct {
	// Unique system generated identifier for the payment item.
	ID string `json:"id,omitempty"`

	// If this settlement was used for a marketplace payment, the wallet involved in the settlement.
	// Not included for standard merchant settlements.
	MerchantWalletID string `json:"merchantWalletId,omitempty"`

	// If this settlement was used for a marketplace payment, the wallet involved in the settlement.
	// Not included for standard merchant settlements.
	WalletID string `json:"walletId,omitempty"`

	// Total debits for the settlement
	TotalDebits *Amount `json:"totalDebits,omitempty"`

	// Total credits for the settlement
	TotalCredits *Amount `json:"totalCredits,omitempty"`

	// Payment fees for the settlement
	PaymentFees *Amount `json:"paymentFees,omitempty"`

	// Chargeback fees for the settlement
	ChargebackFees *Amount `json:"chargebackFees,omitempty"`

	// ISO-8601 UTC date/time format of the settlement creation date.
	CreateDate string `json:"createDate,omitempty"`

	// ISO-8601 UTC date/time format of the settlement update date.
	UpdateDate string `json:"updateDate,omitempty"`
}

Settlement is the object contain the settlement data returned from the API.

type Source

type Source struct {
	// Unique system generated identifier for the payment item.
	ID string `json:"id"`

	// Type of the source.
	// options: card, ach, wire, sepa
	Type SourceType `json:"type"`
}

Source object used for the payment.

type SourceType

type SourceType string

SourceType contains the type value for the source.

const (
	// SourceTypeCard = "card".
	SourceTypeCard SourceType = "card"

	// SourceTypeAch = "ach".
	SourceTypeAch SourceType = "ach"

	// SourceTypeWire = "wire".
	SourceTypeWire SourceType = "wire"

	// SourceTypeSepa = "sepa".
	SourceTypeSepa SourceType = "sepa"
)

type SupportedChain

type SupportedChain string

SupportedChain in Circle.

const (
	// ChainALGO = Algorand blockchain.
	ChainALGO SupportedChain = "ALGO"

	// ChainAVAX = Avalanche blockchain.
	ChainAVAX SupportedChain = "AVAX"

	// ChainBTC = Bitcoin blockchain.
	ChainBTC SupportedChain = "BTC"

	// ChainETH = Ethereum blockchain.
	ChainETH SupportedChain = "ETH"

	// ChainFLOW = Flow blockchain.
	ChainFLOW SupportedChain = "FLOW"

	// ChainHBAR = Hedera Hash graph.
	ChainHBAR SupportedChain = "HBAR"

	// ChainSOL = Solana blockchain.
	ChainSOL SupportedChain = "SOL"

	// ChainTRX = TRON blockchain.
	ChainTRX SupportedChain = "TRX"

	// ChainXLM = Stellar blockchain.
	ChainXLM SupportedChain = "XLM"
)

type SupportedCurrency

type SupportedCurrency string

SupportedCurrency in Circle.

const (
	// USD = USDC stablecoin.
	USD SupportedCurrency = "USD"

	// BTC = Bitcoin.
	BTC SupportedCurrency = "BTC"

	// ETH = Ethereum.
	ETH SupportedCurrency = "ETH"
)

type Transfer

type Transfer struct {
	// Unique identifier for this transfer.
	ID string `json:"id,omitempty"`

	// Source of the funds.
	Source *DepositAddress `json:"source,omitempty"`

	// Destination of the funds.
	Destination *DepositAddress `json:"destination,omitempty"`

	// Nominal value transferred.
	Amount *Amount `json:"amount,omitempty"`

	// A hash that uniquely identifies the on-chain transaction. This is only
	// available where either source or destination are of type blockchain.
	TxHash string `json:"transactionHash,omitempty"`

	// Status of the transfer. Status `pending` indicates that the transfer is in
	// the process of running; `complete` indicates it finished successfully;
	// `failed` indicates it failed.
	Status TransferStatus `json:"status,omitempty"`

	// Indicates the failure reason of a transfer. Only present for transfers in a
	// failed state. Possible values are `insufficient_funds`, `blockchain_error`,
	// `transfer_denied` and `transfer_failed`.
	ErrorCode TransferErrorCode `json:"errorCode,omitempty"`

	// The creation date of the transfer.
	CreateDate string `json:"createDate,omitempty"`
}

Transfer of funds between a `source` and `destination` addresses.

type TransferErrorCode

type TransferErrorCode string

TransferErrorCode contains the error code value for the transfer.

const (
	// TransferErrorCodeInsufficientFunds = "insufficient_funds".
	TransferErrorCodeInsufficientFunds TransferErrorCode = "insufficient_funds"

	// TransferErrorCodeBlockChainError = "blockchain_error".
	TransferErrorCodeBlockChainError TransferErrorCode = "blockchain_error"

	// TransferErrorCodeTransferDenied = "transfer_denied".
	TransferErrorCodeTransferDenied TransferErrorCode = "transfer_denied"

	// TransferErrorCodeTransferFailed = "transfer_failed".
	TransferErrorCodeTransferFailed TransferErrorCode = "transfer_failed"
)

type TransferStatus

type TransferStatus string

TransferStatus contains the status value for the transfer.

const (
	// TransferStatusPending = "pending".
	TransferStatusPending TransferStatus = "pending"

	// TransferStatusComplete = "complete".
	TransferStatusComplete TransferStatus = "complete"

	// TransferStatusFailed = "failed".
	TransferStatusFailed TransferStatus = "failed"
)

type UpdateCardRequest

type UpdateCardRequest struct {
	// Universally unique identifier (UUID v4) of the public key used in encryption.
	// NOTE the sandbox environment uses the default value of key1.
	// For this reason the example supplied is key1 rather than a UUID.
	KeyID string `json:"keyId,omitempty"`

	// PGP encrypted base64 encoded string. Contains Number and CVV.
	EncryptedData string `json:"encryptedData,omitempty"`

	// Two digit number representing the card's expiration month.
	ExpMonth int `json:"expMonth,omitempty"`

	// Four digit number representing the card's expiration year.
	ExpYear int `json:"expYear,omitempty"`
}

UpdateCardRequest contains the data to update a card.

type Wallet

type Wallet struct {
	// Wallet identifier. Numeric value but should be treated as a string as
	// format may change in the future
	ID string `json:"walletId,omitempty"`

	// Unique identifier of the entity that owns the wallet.
	Entity string `json:"entityId,omitempty"`

	// Wallet type.
	Kind string `json:"type,omitempty"`

	// A human-friendly, non-unique identifier for a wallet.
	Description string `json:"description,omitempty"`

	// A list of balances for currencies owned by the wallet.
	Balances []Amount `json:"balances,omitempty"`
}

Wallet entry associated with a user's account.

Directories

Path Synopsis
Package accounts provides access to Circle's Accounts APIs.
Package accounts provides access to Circle's Accounts APIs.
Package core provides access to all core Circle APIs.
Package core provides access to all core Circle APIs.
Package payments provides access to Circle's payments API and related functionality.
Package payments provides access to Circle's payments API and related functionality.
Package payouts provides access to Circle's Payouts APIs.
Package payouts provides access to Circle's Payouts APIs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL