Documentation
¶
Index ¶
- Constants
- type CreatePaymentRequestOptions
- type CreateRefundOptions
- type Options
- type Swish
- func (s *Swish) CreatePaymentRequest(ctx context.Context, opts CreatePaymentRequestOptions) (result createPaymentRequestResponse, err error)
- func (s *Swish) CreateRefund(ctx context.Context, opts CreateRefundOptions) (result createRefundResponse, err error)
- func (s *Swish) Status(ctx context.Context, Location string) (result statusResponse, err error)
Constants ¶
View Source
const (
TestCertificate = "" /* 1816-byte string literal not displayed */
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreatePaymentRequestOptions ¶
type CreatePaymentRequestOptions struct { // Required: The identifier of the payment request to be saved. Example 11A86BE70EA346E4B1C39C874173F088 or d2eb91f4-f3a7-4088-970f-a108b58bf8d9 // The endpoint will format the string to fit Swish specification. InstructionUUID string `json:"-"` // Required: The endpoint Swish will call on with payment status updates, you need to receive data on this endpoint CallbackURL string `json:"callbackUrl"` // Required: The phone number that will receive the payment. Format E.164 except the plus ("+") symbol. PayeeAlias string `json:"payeeAlias"` // Required: The amount that is charged with a float value. Example "100.01" Amount string `json:"amount"` // Required: Currency code according to ISO 4217 Currency string `json:"currency"` // Optional: Payment reference of the payee, which is the merchant that receives the payment. This reference could // be order id or similar. Allowed characters are a-z A-Z 0-9 -_.+*/ and length must be between 1 and 36 characters. PayeePaymentReference string `json:"payeePaymentReference,omitempty"` // Optional: The registered cellphone number of the person that makes the payment. It can only contain numbers and // has to be at least 8 and at most 15 numbers. It also needs to match the following format in order to be found in // Swish: country code + cellphone number (without leading zero). E.g.: 46712345678 PayerAlias string `json:"payerAlias,omitempty"` // Optional: The social security number of the individual making the payment, should match the registered value for // payerAlias or the payment will not be accepted. The value should be a proper Swedish social security number // (personnummer or sammordningsnummer). PayerSSN string `json:"payerSSN,omitempty"` // Optional: Minimum age (in years) that the individual connected to the payerAlias has to be in order for the // payment to be accepted. Value has to be in the range of 1 to 99. PayerAgeLimit string `json:"payerAgeLimit,omitempty"` // Optional: Merchant supplied message about the payment/order. Max 50 chars. Allowed characters are the letters // a-ö, A-Ö, the numbers 0-9 and the special characters :;.,?!()”. Message string `json:"message,omitempty"` }
CreatePaymentRequestOptions for the create payment request
type CreateRefundOptions ¶
type CreateRefundOptions struct { // Required: InstructionUUID The ID for this refund, should be different from create payment request InstructionUUID InstructionUUID string `json:"-"` // Required: OriginalPaymentReference Reference of the original payment that this refund is for. OriginalPaymentReference string `json:"originalPaymentReference"` // Required: CallbackURL URL that Swish will use to notify caller about the outcome of the refund. The URL has to // use HTTPS. CallbackURL string `json:"callbackUrl"` // Required: PayerAlias The Swish number of the merchant that makes the refund payment. PayerAlias string `json:"payerAlias"` // Required: Amount The amount of money to refund. The amount cannot be less than 0.01 SEK and not more than // 999999999999.99 SEK. Moreover, the amount cannot exceed the remaining amount of the original payment that the // refund is for. Amount string `json:"amount"` // Required: Currency The currency to use. The only currently supported value is SEK. Currency string `json:"currency"` // Optional: PayerPaymentReference Payment reference supplied by the merchant. This could be order id or similar. PayerPaymentReference string `json:"payerPaymentReference"` // Optional: Merchant supplied message about the refund. Max 50 chars. Allowed characters are the letters a-ö, A-Ö, // the numbers 0-9 and the special characters :;.,?!()”. Message string `json:"message"` }
CreateRefundOptions for create refund
type Options ¶
type Options struct { // Passphrase is the password for the p12 encoded SSL certificate Passphrase string // SSLCertificate is a byte encoded array with the SSL certificate content SSLCertificate []byte // Test indicates whether the http client will use the test environment endpoint and CA certificate Test bool // enable test environment // CA is base64 encoded string with your certificate authority CA string // Timeout in seconds for the http client Timeout int // Client timeout in seconds }
Options are settings that is used by the http client
type Swish ¶
type Swish struct { // URL is the endpoint which we use to talk with BankID and can be replaced. URL string // contains filtered or unexported fields }
Swish holds settings for this session
func (*Swish) CreatePaymentRequest ¶
func (s *Swish) CreatePaymentRequest(ctx context.Context, opts CreatePaymentRequestOptions) (result createPaymentRequestResponse, err error)
CreatePaymentRequest sends a v2 payment request to Swish to create a payment
func (*Swish) CreateRefund ¶
func (s *Swish) CreateRefund(ctx context.Context, opts CreateRefundOptions) (result createRefundResponse, err error)
CreateRefund A merchant that has received a Swish payment can refund the whole or part of the original transaction amount to the consumer.
Click to show internal directories.
Click to hide internal directories.