github.com/Ingenico-ePayments/connect-sdk-go@v0.0.0-20240318153750-1f8cd329b9c9/examples/merchant/payments/CompletePaymentExample.go (about) 1 // This file was auto-generated from the API references found at 2 // https://epayments-api.developer-ingenico.com/ 3 4 package examples 5 6 import ( 7 "fmt" 8 9 "github.com/Ingenico-ePayments/connect-sdk-go/domain/definitions" 10 "github.com/Ingenico-ePayments/connect-sdk-go/domain/payment" 11 ) 12 13 func completePaymentExample() { 14 client, clientErr := getClient() 15 if clientErr != nil { 16 panic(clientErr) 17 } 18 defer client.Close() 19 20 // Assigning literals to pointer variables directly is not supported. 21 // The below code uses helper function newString to overcome this issue. 22 // http://stackoverflow.com/a/30716481 lists a few more alternatives. 23 // The code for this helper function can be found in file Helper.go 24 25 var card definitions.CardWithoutCvv 26 card.CardNumber = newString("67030000000000003") 27 card.CardholderName = newString("Wile E. Coyote") 28 card.ExpiryDate = newString("1299") 29 30 var cardPaymentMethodSpecificInput payment.CompletePaymentCardPaymentMethodSpecificInput 31 cardPaymentMethodSpecificInput.Card = &card 32 33 var body payment.CompletePaymentRequest 34 body.CardPaymentMethodSpecificInput = &cardPaymentMethodSpecificInput 35 36 response, err := client.Merchant("merchantId").Payments().Complete("paymentId", body, nil) 37 38 fmt.Println(response, err) 39 }