Documentation ¶
Overview ¶
Requests are directives that take the required data from the models and convert it into a proper request that our system can interpret.
We strongly recommend that you use the special methods to create objects from the structure of each request. These methods provide a correctly initialized structure.
There are several methods to make the request, but to prevent failures, you should get better informed about which requests to use on the PixelPay documentation: https://docs.pixelpay.app/docs/en/sdk/requests.
Note that you can use chaining with these methods.
Index ¶
- func ToJson(object interface{}) (string, error)
- type AuthTransaction
- type CaptureTransaction
- type CardTokenization
- type PaymentTransaction
- func (request *PaymentTransaction) SetBilling(billing models.Billing) *PaymentTransaction
- func (request *PaymentTransaction) SetCard(card models.Card) *PaymentTransaction
- func (request *PaymentTransaction) SetCardToken(token string) *PaymentTransaction
- func (request *PaymentTransaction) SetOrder(order models.Order) *PaymentTransaction
- func (request *PaymentTransaction) WithAuthenticationRequest() *PaymentTransaction
- type RequestBehaviour
- type SaleTransaction
- type StatusTransaction
- type VoidTransaction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuthTransaction ¶
type AuthTransaction struct { // Anonymous field, to embed the PaymentTransaction struct (composition) PaymentTransaction }
AuthTransaction defines the structure for an authentication transaction request.
func NewAuthTransaction ¶
func NewAuthTransaction() *AuthTransaction
This function creates a new instance of AuthTransaction with default values for all fields.
type CaptureTransaction ¶
type CaptureTransaction struct { // Payment UUID PaymentUuid string `json:"payment_uuid,omitempty"` // The total amount to capture, equal to or less than the authorized amount. TransactionApprovedAmount string `json:"transaction_approved_amount,omitempty"` // Anonymous field, to embed the RequestBehaviour struct (composition) *RequestBehaviour }
CaptureTransaction defines the structure for a capture transaction request.
func NewCaptureTransaction ¶
func NewCaptureTransaction() *CaptureTransaction
This function creates a new instance of CaptureTransaction with default values for all fields.
type CardTokenization ¶
type CardTokenization struct { // Card number or PAN Number string `json:"number,omitempty"` // Card security code Cvv2 string `json:"cvv2,omitempty"` // Card expire month date (MM) ExpireMonth string `json:"expire_month,omitempty"` // Card expire year date (YYYY) ExpireYear string `json:"expire_year,omitempty"` // Cardholder name Cardholder string `json:"cardholder,omitempty"` // Customer billing address Address string `json:"address,omitempty"` // Customer billing country alpha-2 code (ISO 3166-1) Country string `json:"country,omitempty"` // Customer billing state alpha code (ISO 3166-2) State string `json:"state,omitempty"` // Customer billing city City string `json:"city,omitempty"` // Customer billing postal code Zip string `json:"zip,omitempty"` // Customer billing phone Phone string `json:"phone,omitempty"` // Customer email Email string `json:"email,omitempty"` // Anonymous field, to embed the RequestBehaviour struct (composition) *RequestBehaviour }
CardTokenization defines the structure for a card tokenization request.
func NewCardTokenization ¶
func NewCardTokenization() *CardTokenization
This function creates a new instance of CardTokenization with default values for all fields.
func (*CardTokenization) SetBilling ¶
func (request *CardTokenization) SetBilling(billing models.Billing) *CardTokenization
This function maps the properties of the Billing model to the corresponding fields of the CardTokenization model. It associates the Billing object to the transaction object so that it can be used to perform tokenization.
The `billing` parameter contains the Billing model to be mapped.
This function updates the CardTokenization model.
func (*CardTokenization) SetCard ¶
func (request *CardTokenization) SetCard(card models.Card) *CardTokenization
This function maps the properties of the Card model to the corresponding fields of the CardTokenization model. It associates the Card object to the transaction object so that it can be used to perform tokenization.
The `card` parameter contains the Card model to be mapped.
This function updates the CardTokenization model.
type PaymentTransaction ¶
type PaymentTransaction struct { // Payment UUID PaymentUuid string `json:"payment_uuid,omitempty"` // Tokenized card identifier (T-* format) CardToken string `json:"card_token,omitempty"` // Card number or PAN CardNumber string `json:"card_number,omitempty"` // Card security code CardCvv string `json:"card_cvv,omitempty"` // The card expire CardExpire string `json:"card_expire,omitempty"` // Cardholder name CardHolder string `json:"card_holder,omitempty"` // Customer billing address BillingAddress string `json:"billing_address,omitempty"` // Customer billing country alpha-2 code (ISO 3166-1) BillingCountry string `json:"billing_country,omitempty"` // Customer billing state alpha code (ISO 3166-2) BillingState string `json:"billing_state,omitempty"` // Customer billing city BillingCity string `json:"billing_city,omitempty"` // Customer billing postal code BillingZip string `json:"billing_zip,omitempty"` // Customer billing phone BillingPhone string `json:"billing_phone,omitempty"` // Order customer name CustomerName string `json:"customer_name,omitempty"` // Order customer email CustomerEmail string `json:"customer_email,omitempty"` // Order customer device fingerprint CustomerFingerprint string `json:"customer_fingerprint,omitempty"` // Order ID OrderId string `json:"order_id,omitempty"` // Order currency code alpha-3 OrderCurrency string `json:"order_currency,omitempty"` // Order total amount OrderAmount string `json:"order_amount,omitempty"` // Order total tax amount OrderTaxAmount string `json:"order_tax_amount,omitempty"` // Order total shipping amount OrderShippingAmount string `json:"order_shipping_amount,omitempty"` // Order summary of items or products OrderContent []models.Item `json:"order_content,omitempty"` // Order extra properties OrderExtras map[string]string `json:"order_extras,omitempty"` // Order note or aditional instructions OrderNote string `json:"order_note,omitempty"` // The order callback OrderCallback string `json:"order_callback,omitempty"` // Activate authentication request (3DS/EMV) AuthenticationRequest bool `json:"authentication_request,omitempty"` // Authentication transaction identifier AuthenticationIdentifier string `json:"authentication_identifier,omitempty"` // Anonymous field, to embed the RequestBehaviour struct (composition) *RequestBehaviour }
PaymentTransaction defines the structure for a payment transaction request.
func NewPaymentTransaction ¶
func NewPaymentTransaction() *PaymentTransaction
This function creates a new instance of PaymentTransaction with default values for all fields.
func (*PaymentTransaction) SetBilling ¶
func (request *PaymentTransaction) SetBilling(billing models.Billing) *PaymentTransaction
This function maps the properties of the Billing model to the corresponding fields of the PaymentTransaction model. It associates the Billing object to the transaction object so that it can be used to perform Payment.
The `billing` parameter contains the Billing model to be mapped.
This function updates the PaymentTransaction model.
func (*PaymentTransaction) SetCard ¶
func (request *PaymentTransaction) SetCard(card models.Card) *PaymentTransaction
This function maps the properties of the Card model to the corresponding fields of the PaymentTransaction model. It associates the Card object to the transaction object so that it can be used to perform Payment.
The `card` parameter contains the Card model to be mapped.
This function updates the PaymentTransaction model.
func (*PaymentTransaction) SetCardToken ¶
func (request *PaymentTransaction) SetCardToken(token string) *PaymentTransaction
This function associates the token of the card to the corresponding fields of the PaymentTransaction model. It associates a Card to the transaction object so that it can be used to perform Payment.
The `token` parameter is a unique key associated to a Card.
This function updates the PaymentTransaction model.
func (*PaymentTransaction) SetOrder ¶
func (request *PaymentTransaction) SetOrder(order models.Order) *PaymentTransaction
This function maps the properties of the Order model to the corresponding fields of the PaymentTransaction model. It associates the Order object to the transaction object so that it can be used to perform Payment.
The `order` parameter contains the Order model to be mapped.
This function updates the PaymentTransaction model.
func (*PaymentTransaction) WithAuthenticationRequest ¶
func (request *PaymentTransaction) WithAuthenticationRequest() *PaymentTransaction
This function enables 3DS/EMV authentication for the PaymentTransaction model, so that will be required to perform Payment.
This function updates the PaymentTransaction model.
type RequestBehaviour ¶
type RequestBehaviour struct { // Environment identifier (live|test|sandbox) Env string `json:"env,omitempty"` // Transaction response messages language Lang string `json:"lang,omitempty"` // SDK identifier type From string `json:"from,omitempty"` // SDK version SdkVersion string `json:"sdk_version,omitempty"` }
RequestBehaviour defines the structure for the request behaviour.
func NewRequestBehaviour ¶
func NewRequestBehaviour() *RequestBehaviour
This function creates a new instance of RequestBehaviour with default values for all fields.
type SaleTransaction ¶
type SaleTransaction struct { // Transaction installment type InstallmentType string `json:"installment_type,omitempty"` // Transaction installment value InstallmentMonths string `json:"installment_months,omitempty"` // Transaction total points redeem amount PointsRedeemAmount string `json:"points_redeem_amount,omitempty"` // Anonymous field, to embed the PaymentTransaction struct (composition) PaymentTransaction }
SaleTransaction defines the structure for a sale transaction request.
func NewSaleTransaction ¶
func NewSaleTransaction() *SaleTransaction
This function creates a new instance of SaleTransaction with default values for all fields.
func (*SaleTransaction) SetInstallment ¶
func (request *SaleTransaction) SetInstallment(installmentMonths int, installmentType string) *SaleTransaction
This function sets the Installment service values to a transaction.
The `installmentMonths` parameter contains the number of installment months. The `installmentType` parameter contains the the installment type.
func (*SaleTransaction) WithPointsRedeemAmount ¶
func (request *SaleTransaction) WithPointsRedeemAmount(amount float64) *SaleTransaction
This function sets the transaction points redeem amount.
The `amount` parameter contains the amount of points to redeem.
type StatusTransaction ¶
type StatusTransaction struct { // Payment UUID PaymentUuid string `json:"payment_uuid,omitempty"` // Anonymous field, to embed the RequestBehaviour struct (composition) *RequestBehaviour }
StatusTransaction defines the structure for a status transaction request.
func NewStatusTransaction ¶
func NewStatusTransaction() *StatusTransaction
This function creates a new instance of StatusTransaction with default values for all fields.
type VoidTransaction ¶
type VoidTransaction struct { // Payment UUID PaymentUuid string `json:"payment_uuid,omitempty"` // Reason for void the order VoidReason string `json:"void_reason,omitempty"` // Required signature for void authentication VoidSignature string `json:"void_signature,omitempty"` // Anonymous field, to embed the RequestBehaviour struct (composition) *RequestBehaviour }
VoidTransaction defines the structure for a void transaction request.
func NewVoidTransaction ¶
func NewVoidTransaction() *VoidTransaction
This function creates a new instance of VoidTransaction with default values for all fields.