Adding parameters to the API

Hey

I’m trying to add the parameters to the API call so I can pass the needed values to the API call

But, when I tried to add the parameters I got this error

Any help aprreicated

Can you share what you put in parameter?
Also, do you have a content-type header set to application/json?
And actually you added a parameter but you should replace the 1 in body by <amount> and this will give you the json parameter

@Jici
sure here is the API docs

This the auth tab

here is the API call tab

it should be generated like this , but for my call is not generated

To generate the body parameters, you need to use in json body where the value shoud be. So amount will be "amount":<amount>

I just tried it

here is the error response

For amount no decimal. 100 only. And you have deleted the comma after the >

"amount":<amount>,

changed to this error

You didn’t entr anything in the currency “value” field. Also, if you remove the " around <currency>, you need to enter the quotes in the value field like “USD”
So two options
"currency: "<currency>", and the value will be USD
or "currency: <currency>, and the value will be “USD”

1 Like

I think it worked , because the error statement changed to verification error

Is it ?

Just check the error , it matter of <1125 Source id is invalid>

I have to pass the source id

Thank you for support ! appreciated

Exactly. You need to provide some more info to get it work correctly. The response you will get will look like that (raw)

{
  "object": "charge",
  "live_mode": false,
  "api_version": "V1.2",
  "id": "chg_sfdf876sdvisdjhf",
  "status": "INITIATED",
  "amount": 1,
  "currency": "KWD",
  "threeDSecure": true,
  "save_card": false,
  "description": "Test Description",
  "statement_descriptor": "sample",
  "metadata": {
    "udf1": "test"
  },
  "transaction": {
    "authorization_id": "348683",
    "timezone": "UTC+03.00",
    "created": "1234343434",
    "url": "https://url.com/payment_url"
  },
  "reference": {
    "track": "trk_dfdf8yshdfsdf",
    "payment": "pay_dfjdfy8adf6",
    "gateway": "86564679",
    "acquirer": "868688687",
    "transaction": "txn_0001",
    "order": "ord_0001"
  },
  "response": {
    "code": "100",
    "message": "Initiated"
  },
  "receipt": {
    "id": "23290879808",
    "email": false,
    "sms": true
  },
  "customer": {
    "first_name": "test",
    "middle_name": "test",
    "last_name": "test",
    "email": "[email protected]",
    "phone": {
      "country_code": "965",
      "number": "50000000"
    }
  },
  "source": {
    "object": "source",
    "id": "src_kw.knet"
  },
  "post": {
    "url": "http://your_website.com/post_url"
  },
  "redirect": {
    "url": "http://your_website.com/redirect_url"
  }
}

You will first need to get a card token using this endpoint

And this will be the token to use I guess for the charge source

1 Like

Yes I installed the Js card to generate the id token from the card info, and to pass it with API request as source id

1 Like

@Jici sorry, but i did generate the token id using the test card, but go this response is "invalid source "


‏‏لقطة الشاشة (358)

any idea why it happening ?

Did you test using API to generate the token instead of JS? It will be easier to help you that way because debugging the JS may be more complex

I used the JS card form , the problem with generating the id through APi , it would be not PCI complaint method as far i know bubble is not a PCI complaint , so the JS card is preferable to generate the id token

PCI is mostly handle by you and how you handle data. However I can only agree that using the JS SDK is a better solution probably.

1 Like

@Jici

That’s great! , i will try it without the js card


Just ran the API , and i got this response