pay-pal store credit card details in vault is not working in rails

60 Views Asked by At

I am using https://developer.paypal.com/docs/api/vault/#credit-card_create to store the credit card details in paypal vault using gem 'typhoeus'. I have followed the step which is provided by paypal api but i am getting INTERNAL_SERVICE_ERROR. This is what i have done to store credit-card. Please give me suggestion to my code. Thank you all.

credit_card = {
  number: "***************",
      type: "visa",
      expire_month: 11,
      expire_year: 2018,
      cvv2: "874",
      first_name: "Joe",
      last_name: "Shopper",
  billing_address: {
    line1: "52 N Main St.",
    city: "Johnstown",
    country_code: "US",
    postal_code: "43210",
    state: "OH",
    phone: "408-334-8890"
  },
    external_customer_id: "joe_shopper408-334-8890"
}
    result = Typhoeus.post('https://api.sandbox.paypal.com/v1/vault/credit-cards' ,:headers => { 'Content-Type' => 'application/json', "Authorization" => "Bearer *****************"}, :params => credit_card)
    Yajl::Parser.parse(result.body)
    render json: { status: 200 }
0

There are 0 best solutions below