Example: Map a UDF

This example can be applied to any UDF for a Pay Now payment to a Braintree custom field.

About this task

This example describes how to map a payment reason for a Pay Now payment to a Braintree custom field.

Procedure

  1. Define a custom MDC that extends the MtxBraintreeChargeMethodExtension to contain the UDF field.
    For example:
    Added MDC:00036:What is the container's name?MyBraintreeChargeMethodExtension
    Added MDC:00036:What is the container's key?-85
    Added MDC:00036:What is the name of the base container (if any)?MtxBraintreeChargeMethodExtension
    Added MDC:00036:What is the created schema version?2
    Added MDC:00036:What is the deleted schema version?0
  2. Add a new field, PaymentReason, to the MtxBraintreeChargeMethodExtension MDC.
    For example:
    New MyBraintreeChargeMethodExtension field:00003:What is the field's name?PaymentReason
    New MyBraintreeChargeMethodExtension field:00003:What is the field's type?string
    New MyBraintreeChargeMethodExtension field:00003:What is the field's max-size?0
    New MyBraintreeChargeMethodExtension field:00003:Is this field a list (y/n)?n
    New MyBraintreeChargeMethodExtension field:00003:Is this field an array (y/n)?n
    New MyBraintreeChargeMethodExtension field:00003:What is the created schema version?2
    New MyBraintreeChargeMethodExtension field:00003:What is the deleted schema version?0
  3. Configure the UDF in payment-service.yaml to map the new field created in the previous step to a Braintree custom field (for example, payment_reason).
    For example:
    payment:
      gateway:
        braintree:
          configs:
            default:
              environment: <environment> 
              failOnDuplicatePaymentMethod: "false"
              merchantId: x
              publicKey: x
              privateKey: x
              userDefinedFields[payment_reason]:
                defaultValue: Undefined*
                mdcFieldName: PaymentReason