0
votes

i need to get payment with Braintree and as far as i understand from the Braintree's documentation,followed the these steps;

  1. created a Gateway

     BraintreeGateway Gateway = new BraintreeGateway
    {
        Environment = Braintree.Environment.SANDBOX,
        MerchantId = "xxxxxxxxxxx",
        PublicKey = "yyyyyyyyyyyyyyy",
        PrivateKey = "zzzzzzzzzzzzzzz",
    };
    
  2. created a Customer

    var request = new CustomerRequest
    {
        FirstName = "firstName",
        LastName = "lastName",
        Email = "eMail",
        Phone = "phone",
    };
    string CustomerId = Gateway.Customer.Create(request).Target.Id;
    
  3. created a credit card of the customer as using returened customerid

    var creditCardRequest = new CreditCardRequest
    {
        CustomerId = CustomerId,
        Number = "credit_card_number",
        ExpirationDate = "ex_date",
        CVV = "cc_cvv"
    };
    
    string creditCardToken = Gateway.CreditCard.Create(creditCardRequest).Target.Token;
    

what then? need a transaction with amount but the using what i found is not related with customer or credit card. Can someone help about what i should do next? Especially i need a method without 3d secure.

1
Are you aware that you included your merchant ID, public key, and private key? That's an extremely bad idea for what I hope are obvious reasons. I redacted them.Daniel Mann
TBH, the question should be deleted and then re-added; people still have access to the keys from the OP... @Daniel Mannzaggler
@Çöđěxěŕ I flagged the post to see if moderators can expunge the revision history.Daniel Mann
Of course i awared when i added my comment, it just to test as you can see the environment what i used is Sandbox, that means the informations are just for testing.Seda Özdemir

1 Answers

1
votes

The answer of support: To create a transaction, you must include an amount and either a paymentMethodNonce, a paymentMethodToken, or a customerId. Passing a customerId is equivalent to passing the paymentMethodToken of the customer's default payment method.

  TransactionRequest transactionRequest = new TransactionRequest()
    {
        Amount = amount,
        CustomerId = customer.Id,
        Options = new TransactionOptionsRequest
        {
            SubmitForSettlement = true
        }
    };

    Result<Transaction> result = Gateway.Transaction.Sale(transactionRequest);