amount := int64(1299)
currency := "USD"
country := "US"
method := components.RedirectPaymentMethodCreateMethodAffirm
redirectUrl := "https://example.com/callback"
redirectPaymentMethodCreate := components.RedirectPaymentMethodCreate{
Method: method,
Country: country,
Currency: currency,
RedirectURL: redirectUrl,
}
paymentMethod := components.CreateTransactionCreatePaymentMethodRedirectPaymentMethodCreate(redirectPaymentMethodCreate)
transactionCreate := components.TransactionCreate{
Amount: amount,
Currency: currency,
Country: &country,
PaymentMethod: &paymentMethod,
ConnectionOptions: map[string]any{
"affirm-affirm": map[string]any{
"itinerary": map[string]string{
"type": "event",
"sku": "ABC123",
"display_name": "Bad Bunny at Petco Park",
"venue": "Petco Park",
"location": "100 Park Blvd, San Diego, CA 92101, US",
"date_start": "2022-12-06T03:00:00.000Z UTC",
},
"discounts": map[string]any{
"RETURN5": map[string]any{
"discount_amount": 500,
"discount_display_name": "Returning customer 5% discount",
},
"PRESDAY10": map[string]any{
"discount_amount": 1000,
"discount_display_name": "President's Day 10% off",
},
},
},
},
}
transaction, err := client.Transactions.Create(ctx, transactionCreate, nil, nil, nil)