Documentation ¶
Index ¶
- Constants
- type Buyer
- type BuyerDocument
- type ErrorResponse
- type Metadata
- type PaymentItem
- type PaymentPreResponse
- type PaymentPreSubmitResult
- type PaymentRequest
- func (r *PaymentRequest) AddItem(id string, description string, amount float64, quantity int) *PaymentItem
- func (r *PaymentRequest) SetBuyer(name, email string) *Buyer
- func (r *PaymentRequest) SetShipping(shippingType int, shippingCost float64) *Shipping
- func (r *PaymentRequest) Submit() (result *PaymentPreSubmitResult)
- type Phone
- type Shipping
- type ShippingAddress
- type Transaction
- type TransactionPaymentMethod
- type XMLError
Constants ¶
View Source
const ( ShippingPAC = 1 ShippingSEDEX = 2 ShippingOther = 3 XMLHeader = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>` CheckoutURL = "https://ws.pagseguro.uol.com.br/v2/checkout" TransactionsURL = "https://ws.pagseguro.uol.com.br/v2/transactions/notifications" TransactionTypePayment = 1 TransactionStatusAwaitingPayment = 1 TransactionStatusInAnalysis = 2 TransactionStatusPaid = 3 TransactionStatusAvailable = 4 TransactionStatusInDispute = 5 TransactionStatusReturned = 6 TransactionStatusCanceled = 7 PaymentMethodCreditCardVisa = 101 PaymentMethodCreditCardMasterCard = 102 PaymentMethodCreditCardAMEX = 103 PaymentMethodCreditCardDiners = 104 PaymentMethodCreditCardHipercard = 105 PaymentMethodCreditCardAura = 106 PaymentMethodCreditCardElo = 107 PaymentMethodCreditCardPLENOCard = 108 PaymentMethodCreditCardPersonalCard = 109 PaymentMethodCreditCardJCB = 110 PaymentMethodCreditCardDiscover = 111 PaymentMethodCreditCardBrasilCard = 112 PaymentMethodCreditCardFORTBRASIL = 113 PaymentMethodCreditCardCARDBAN = 114 PaymentMethodCreditCardVALECARD = 115 PaymentMethodCreditCardCabal = 116 PaymentMethodCreditCardMais = 117 PaymentMethodCreditCardAvista = 118 PaymentMethodCreditCardGRANDCARD = 119 PaymentMethodBoletoBradesco = 201 PaymentMethodBoletoSantander = 202 PaymentMethodDebitoOnlineBradesco = 301 PaymentMethodDebitoOnlineItau = 302 PaymentMethodDebitoOnlineUnibanco = 303 PaymentMethodDebitoOnlineBancoDoBrasil = 304 PaymentMethodDebitoOnlineBancoReal = 305 PaymentMethodDebitoOnlineBanrisul = 306 PaymentMethodDebitoOnlineHSBC = 307 PaymentMethodSaldoPagSeguro = 401 PaymentMethodOiPaggo = 501 PaymentMethodDepositoContaBancoDoBrasil = 701 PaymentMethodDepositoContaHSBC = 702 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Buyer ¶
type Buyer struct { Email string `xml:"email"` Name string `xml:"name"` Phone *Phone `xml:"phone,omitempty"` Documents []*BuyerDocument `xml:"documents>document,omitempty"` BornDate string `xml:"bornDate,omitempty"` //dd/MM/yyyy optional }
type BuyerDocument ¶
type ErrorResponse ¶
type ErrorResponse struct {
Errors []XMLError `xml:"errors"`
}
type PaymentItem ¶
type PaymentItem struct { XMLName xml.Name `xml:"item"` Id string `xml:"id"` Description string `xml:"description"` PriceAmount string `xml:"amount"` Quantity string `xml:"quantity"` ShippingCost string `xml:"shippingCost,omitempty"` Weight string `xml:"weight,omitempty"` }
func (*PaymentItem) SetAmount ¶
func (r *PaymentItem) SetAmount(amount float64) *PaymentItem
func (*PaymentItem) SetQuantity ¶
func (r *PaymentItem) SetQuantity(quantity int) *PaymentItem
func (*PaymentItem) SetShippingCost ¶
func (r *PaymentItem) SetShippingCost(cost float64) *PaymentItem
func (*PaymentItem) SetWeight ¶
func (r *PaymentItem) SetWeight(grams int) *PaymentItem
type PaymentPreResponse ¶
type PaymentPreSubmitResult ¶
type PaymentPreSubmitResult struct { CheckoutResponse *PaymentPreResponse Error *ErrorResponse Success bool }
type PaymentRequest ¶
type PaymentRequest struct { XMLName xml.Name `xml:"checkout"` Email string `xml:"email"` Token string `xml:"token"` Currency string `xml:"currency"` Items []*PaymentItem `xml:"items>item"` ReferenceID string `xml:"reference"` Buyer *Buyer `xml:"sender"` Shipping *Shipping `xml:"shipping"` ExtraAmount string `xml:"extraAmount,omitempty"` // use this for discounts or taxes RedirectURL string `xml:"redirectURL,omitempty"` NotificationURL string `xml:"notificationURL,omitempty"` MaxUses string `xml:"maxUses,omitempty"` // from 0 to 999 (the amount of tries a user can do with the same reference ID) MaxAge string `xml:"maxAge,omitempty"` // time (in seconds) that the returned payment code is valid (30-999999999) Metadata []*Metadata `xml:"metadata,omitempty"` // https://pagseguro.uol.com.br/v2/guia-de-integracao/api-de-pagamentos.html#v2-item-api-de-pagamentos-parametros-http IsSandbox bool `xml:"-"` // o PagSeguro não tem um modo sandbox no momento (╯°□°)╯︵ ┻━┻ }
func NewPaymentRequest ¶
func NewPaymentRequest(sellerToken, sellerEmail, referenceID, redirectURL, notificationURL string) *PaymentRequest
func (*PaymentRequest) AddItem ¶
func (r *PaymentRequest) AddItem(id string, description string, amount float64, quantity int) *PaymentItem
func (*PaymentRequest) SetBuyer ¶
func (r *PaymentRequest) SetBuyer(name, email string) *Buyer
func (*PaymentRequest) SetShipping ¶
func (r *PaymentRequest) SetShipping(shippingType int, shippingCost float64) *Shipping
func (*PaymentRequest) Submit ¶
func (r *PaymentRequest) Submit() (result *PaymentPreSubmitResult)
type Shipping ¶
type Shipping struct { Type string `xml:"type"` Cost string `xml:"cost"` Address *ShippingAddress `xml:"address,omitempty"` }
func (*Shipping) SetAddress ¶
func (*Shipping) SetAddressCountry ¶
func (*Shipping) SetAddressStateCity ¶
type ShippingAddress ¶
type ShippingAddress struct { Country string `xml:"country"` // It's always "BRA" ¯\_(ツ)_/¯ State string `xml:"state,omitempty"` // "SP" City string `xml:"city,omitempty"` // max 60 min 2 PostalCode string `xml:"postalCode,omitempty"` // XXXXXXXX District string `xml:"district,omitempty"` // Bairro | max chars: 60 Street string `xml:"street,omitempty"` // max: 80 Number string `xml:"number,omitempty"` // max: 20 Complement string `xml:"complement,omitempty"` // max: 40 }
type Transaction ¶
type Transaction struct { XMLName xml.Name `xml:"transaction"` Date string `xml:"date,omitempty"` Code string `xml:"code,omitempty"` Reference string `xml:"reference,omitempty"` Type int `xml:"type,omitempty"` Status int `xml:"status,omitempty"` LastEventDate string `xml:"lastEventDate,omitempty"` PaymentMethod *TransactionPaymentMethod `xml:"paymentMethod,omitempty"` GrossAmount string `xml:"grossAmount,omitempty"` DiscountAmount string `xml:"discountAmount,omitempty"` FeeAmount string `xml:"feeAmount,omitempty"` NetAmount string `xml:"netAmount,omitempty"` EscrowEndDate string `xml:"escrowEndDate,omitempty"` ExtraAmount string `xml:"extraAmount,omitempty"` InstallmentCount int `xml:"installmentCount,omitempty"` ItemCount int `xml:"itemCount,omitempty"` Items []*PaymentItem `xml:"items>item,omitempty"` Buyer *Buyer `xml:"sender,omitempty"` Shipping *Shipping `xml:"shipping,omitempty"` CancellationSource string `xml:"cancellationSource,omitempty"` }
func FetchTransactionInfo ¶
func FetchTransactionInfo(sellerToken, sellerEmail, notificationCode string) (result *Transaction, err error)
Click to show internal directories.
Click to hide internal directories.