Determine where which payment Refund is associated with
With the recent changes of removing PaymentId from Refund, how do we, using the Refund object, determine which payment the refund is attached to? Also, is there a way, using the Refund object, to determine if a refund is from a credit balance? Also, is there an updated documentation for the API to reference with these recent changes?
Re: Determine where which payment Refund is associated with
You are asking three questions. I will reply to them in order.
I show you how to use the Data Source function of the UI instead of using the API.
If you want to query these via the API, you will be using Export ZOQL.
To learn how to execute Export ZOQL via the API please refer to the following link:
1. How to find Payment related to Refund
In order to find a Payment related to Refund object, you need to search the RefundInvoicePayment object.
When you create Refund for Payment, Zuora creates RefundInvoicePayment at the same time.
> A RefundInvoicePayment object is created when you create a Refund object. This object ties the Refund object to the associated InvoicePayment object.
You can know RefundId and PaymentId by setting RefundInvoicePayment object as base.
Select "Refund Invoice Payment" as Data Source:
Select Payment.Id and Refund.Id.
There is a constraint that the PaymentId field of the Refund object can not be queried directly.
It can be confirmed since there is no "Query" string here.
2. How to find Refund for Credit Balance
Refund object has a SourceType field. This field contains the string "Payment" or "CreditBalance".
> Specifies whether the refund is a refund payment or a credit balance.
So, in order to find Refund for Credit Balance, execute Data Source function under the following conditions:
If Refund is created for CreditBalance, no RefundInvoicePayment object is created.
3. PaymentId was removed from Refund
I think, PaymentId has not been removed from Refund.
If such action is taken, it will be listed in API Changelog.
Also, you can check the fields of the object using the describe call.
I confirmed the field of Refund object. It has PaymentId field.