Payhere Customers -> Payments -> Find matching payment to row id

The issue:
Hello this post is referencing this video here
The difference of my approach is that I am trying to find payments with matching hidden fields instead of subscriptions.

I’ve made it to this part where all there is left is to fetch to correct data from JSON customer Data.
As it stands it fetches all payments, where I need it to fetch the one that matches the rowid.

Resolution I’m looking for:

  1. Take the JSON output below and find the bid_id (this is the rowid)
  2. Then sort the bid_id to the current table’s rowid so that the json output matches it’s rowid/bidid

Proposed solution: perhaps there is a java formula that could be used here to find the match, no luck with my testing.

JSON Output:
“id”: 246792,
“reference”: null,
“amount_in_cents”: 105,
“stripe_charge_id”: “ch_3NuSWmL0nr8YXLGN1m6T1f7G”,
“company_id”: 6761,
“created_at”: “2023-09-26T04:05:44.103Z”,
“updated_at”: “2023-09-26T04:05:44.103Z”,
“card_brand”: “discover”,
“card_country”: null,
“card_last4”: “3595”,
“secure_token”: “QJiiKfvV11KHplMXEAxqhA”,
“application_fee_in_cents”: 2,
“metadata”: {
“gateway_fee_in_cents”: 33
“subscription_id”: null,
“customer_id”: 292199,
“user_present”: true,
“products_purchased”: ,
“ip_address”: “2603:6010:ba00:b615:c534:516b:a3d7:6c7f”,
“location”: {},
“status”: “success”,
“refunded_at”: null,
“refund_amount_in_cents”: 0,
“currency”: “usd”,
“stripe_card_token”: null,
“last_error”: null,
“object_type”: “Plan”,
“object_id”: 23514,
“usd_amount_in_cents”: 105,
“stripe_payment_method”: null,
“purchased_qty”: 1,
“provider”: “stripe”,
“custom_fields”: {
“bid_id”: “XqyZmAEhR9mGjFrjkzuafg”,
“user_id”: “392f639a-eb36-4ceb-a516-900a21eca986”
“gocardless_payment_id”: null,
“failed_attempts”: 0,
“vat_included”: false,
“vat_rate”: “0.0”,
“vat_amount_in_cents”: 0,
“ex_vat_amount_in_cents”: 105,
“country_code”: “US”,
“invoice_id”: null,
“coupon_code”: null,
“discount_percent”: “0.0”,
“temporary”: false

Trying to use the distinct call to filter it.

$distinct(custom_fields.bid_id) => [“X”]

Not working so far…

Maybe a filter() function?

1 Like

Thank you for the response!

I found this method as well which I found to work.

Searches for successful payments and only checks true if the row_id matches.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.