Skip to content

Conversation

@sakksham7
Copy link
Contributor

@sakksham7 sakksham7 commented Sep 10, 2025

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

#1206
Added get-intent call for v2.
Its a new API call where other info related to a payment will come other than payment methods enabled and saved methods.
For example - payment-type

How did you test it?

Tested from SDK
Screenshot 2025-09-10 at 12 14 26 PM

Response -

{
    "id": "12345_pay_01997a6d32a77c43a4cab20798914f82",
    "status": "requires_payment_method",
    "amount_details": {
        "order_amount": 100,
        "currency": "USD",
        "shipping_cost": null,
        "order_tax_amount": null,
        "external_tax_calculation": "skip",
        "surcharge_calculation": "skip",
        "surcharge_amount": null,
        "tax_on_surcharge": null
    },
    "client_secret": null,
    "profile_id": "pro_UstHbnwk2stSwiKvR8A6",
    "merchant_reference_id": "NOPA",
    "routing_algorithm_id": null,
    "capture_method": "automatic",
    "authentication_type": "no_three_ds",
    "billing": {
        "address": {
            "city": "test",
            "country": "NL",
            "line1": "here is some \n there is some \n none is some? \n ",
            "line2": "there",
            "line3": "anywhere",
            "zip": "560095",
            "state": "SE",
            "first_name": "Sakil",
            "last_name": "Mostak",
            "origin_zip": null
        },
        "phone": {
            "number": "1234567890",
            "country_code": "+1"
        },
        "email": "guest@example.com"
    },
    "shipping": {
        "address": {
            "city": "Karwar",
            "country": "NL",
            "line1": null,
            "line2": null,
            "line3": null,
            "zip": "581301",
            "state": "Karnataka",
            "first_name": "John",
            "last_name": "Dough",
            "origin_zip": null
        },
        "phone": null,
        "email": "example@example.com"
    },
    "customer_id": null,
    "customer_present": "present",
    "description": null,
    "return_url": null,
    "setup_future_usage": "on_session",
    "apply_mit_exemption": "Skip",
    "statement_descriptor": null,
    "order_details": null,
    "allowed_payment_method_types": null,
    "metadata": {
        "udf": "test"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "payment_link_enabled": "Skip",
    "payment_link_config": null,
    "request_incremental_authorization": "false",
    "split_txns_enabled": "skip",
    "expires_on": "2025-09-24T06:48:20.841Z",
    "frm_metadata": null,
    "request_external_three_ds_authentication": "Skip",
    "payment_type": "normal"
}

Checklist

  • I ran npm run re:build
  • I reviewed submitted code
  • I added unit tests for my changes where possible

@sakksham7 sakksham7 added the Ready for Review PR with label Ready for Review should only be reviewed. label Sep 10, 2025
@semanticdiff-com
Copy link

Review changes with  SemanticDiff

aritro2002
aritro2002 previously approved these changes Sep 10, 2025
dict
->Dict.get(key)
->Option.flatMap(JSON.Decode.object)
->Option.getOr(Dict.make())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use Utils.getDictFromDict

->Option.getOr(Dict.make())
let response = intentDict->itemToIntentObjMapper

LoadedIntent(response)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this state? No loading and all??

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loading is by default value and after getting the response we are setting it to Loaded

}

let uri = `${endpoint}/v2/payments/${paymentId}/get-intent`
fetchApi(uri, ~method=#GET, ~headers=headers->ApiEndpoint.addCustomPodHeader(~customPodUri))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to async await structure. Please refactor thsi file - src/Utilities/PaymentHelpersV2.res similar to src/Utilities/PaymentHelpers.res. It's a long due task pending

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this one to async await structure, Disabled logging since its not in V2 yet, Will refactor the other calls as well in the upcoming PR

Sanskar2001
Sanskar2001 previously approved these changes Sep 23, 2025
aritro2002
aritro2002 previously approved these changes Sep 23, 2025
Sanskar2001
Sanskar2001 previously approved these changes Sep 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ready for Review PR with label Ready for Review should only be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants