Skip to content

MHR API - Non-Staff Credit Card Payment #27259

Closed
Closed

Description

@LizGovier
  • Optional new request parameter (ccPayment=true) for all public registration endpoints to indicate CC payment (if preferred account payment is not CC). UI should know the payment method in advance to handle the mhr api response and redirect user to the CC payment url.
  • Save draft record without marking it as consumed if pay api call is successful.
  • Associate the pay api response invoice id with the draft.
  • For change registrations lock the manufactured home to prevent further changes until payment completes.
  • Return to the UI the pay api response invoice ID and hopefully payment redirect url (possibly the complete pay api invoice response JSON). Response HTTP status is 202 accepted; new payload paymentPending property is set to true.
  • Update ppr-sub proxy to receive MHR pub/sub pay completion event subscription requests.
  • Create new endpoint to receive payment complete requests and create the registration.

Sequence Diagram:
MHR-non-staff-cc-payment.png

Questions for relationships:

  1. How do you set up a CC payment pay api request when CC payment is not the default/preferred method? Request payload example without the payment method:
    POST https://pay-api-dev-142173140222.northamerica-northeast1.run.app/api/v1/payment-requests
{
    "filingInfo": {
        "folioNumber": "UT-PAY-PERMIT-1",
        "filingTypes": [
            {
                "filingTypeCode": "TRAPP",
                "priority": false,
                "futureEffective": false,
                "quantity": 1
            }
        ]
    },
    "businessInfo": {
        "corpType": "MHR"
    },
   "details":[
      {
         "label":"TP TRAPP test:",
         "value":"TRAPP fee code"
      }
   ]
}

Answer: add to the pay api request

    "paymentInfo": {
       "methodOfPayment": "DIRECT_PAY"
    }
  1. What is the URL by environment for the client to pay by CC after a pay api /api/v1/payment-requests request completes?
    Answer configurable by environment from 1password variable PAYMENT_PORTAL_URL. The format is:
    {PAYMENT_PORTAL_URL}/{invoice_id}/{return_URL}
    Currently:
    https://dev.account.bcregistry.gov.bc.ca/makepayment/{invoiceId}/{returnURL}
    https://test.account.bcregistry.gov.bc.ca/makepayment/{invoiceId}/{returnURL}
    https://sandbox.account.bcregistry.gov.bc.ca/makepayment/{invoiceId}/{returnURL}
    https://www.account.bcregistry.gov.bc.ca/makepayment/{invoiceId}/{returnURL}
    The invoice id will be returned in the MHR API response in the payment information.
    The return URL must be escaped - see example in Travis's comment below.

  2. If a payment invoice corpType is MHR or PPR and the payment method is CC, can assets be notified by the pay api once a CC payment completes by publishing the event on a GCP pub/sub topic? Can the topic be created in the assets project with access given to the pay api SA? What is the pay api payload for these notifications? Assets needs the invoice ID, corpType (MHR/PPR), and probably the payment status.
    Answer:
    Dedicated assets topic running in the pay api GCP project. Coordinate with Patrick W and update the pub/sub integration with pay api here:
    https://www.figma.com/board/ZLlmaQ5sCsBEkUxUtsETwQ/PUB-SUB-Queue-Mapping?node-id=0-1&p=f&t=AhzRDxeoJwt3C2Lg-0
    Pub/Sub payload example:

{
  "id": "12342432",
  "statusCode": "COMPLETED",
  "filingIdentifier": "",
  "corpTypeCode": "MHR"
}

Activity

  1. changed the title [-]MHR API - Credit Card Payment[/-] [+]MHR API - Non-Staff Credit Card Payment[/+] on Apr 17, 2025
  2. self-assigned this
    on Apr 23, 2025
  3. doug-lovett commented on Apr 25, 2025

    @doug-lovett
    Collaborator

    @LizGovier I have added the non staff CC payment diagram to this ticket.

  4. LizGovier commented on Apr 25, 2025

    @LizGovier
    Author

    You're the best! Thanks @doug-lovett

  5. added
    Pay
    on Apr 29, 2025
  6. seeker25 commented on Apr 29, 2025

    @seeker25
    Contributor

    @doug-lovett @cameron-eyds

    1. Payload override for credit card:
      https://github.com/bcgov/STRR/blob/c78535b55d0dc233c1e6d743aee7ae51bd7aa957/strr-api/src/strr_api/services/payment_service.py#L135
    {
        "filingInfo": {
            "filingTypes": [
                {
                    "filingTypeCode": "INREG",
                    "priority": false,
                    "futureEffective": false,
                    "quantity": 1
                }
            ]
        },
        "businessInfo": {
            "corpType": "MHR"
        },
        "details": [
            {
                "label": "MH Registration Type:",
                "value": "MANUFACTURED HOME REGISTRATION"
            }
        ],
        "paymentInfo": {
           "methodOfPayment": "DIRECT_PAY"
        }
    }
    1. Payload PUBSUB message example:

    Here's a full example of a route that Search built:

    https://github.com/bcgov/registries-search/blob/8d9f07abe0280af3d4804a800ebc1f92dc5c894a/search-api/src/search_api/resources/v2/payments/payments.py#L34

    Example here from names Andriy Built:

    https://github.com/bcgov/namex/blob/42d24c343338ed13217fc9118a1d77760d2f74a0/services/namex-pay/src/namex_pay/resources/worker.py#L75

    Here's the payload dataclass:

    https://github.com/bcgov/namex/blob/42d24c343338ed13217fc9118a1d77760d2f74a0/services/namex-pay/src/namex_pay/resources/worker.py#L104

    Here's some examples from logs:

    Image

    Talk to @pwei1018 about getting this setup, he has to maintain it

    1. Payment url example:

    "VUE_APP_PAYMENT_PORTAL_URL":"https://test.account.bcregistry.gov.bc.ca/makepayment/"

    Here is some namerequest code that uses it, can look up the same in STRR.

    https://github.com/bcgov/namerequest/blob/e6991204ca462ebd5ed45f3b8ba48f9d0fe6f39e/app/src/mixins/payment-mixin.ts#L494

    paymentToken is the invoice id coming from the create invoice response.

    There's also another field you should check for in the invoice response:

    isPaymentActionRequired (this turns on for online banking and credit card) if that's true you'll need to redirect to makepayment url

    Here's an example from PROD:

    https://www.account.bcregistry.gov.bc.ca/makepayment/8071147/https%3A%2F%2Fwww.names.bcregistry.gov.bc.ca%2Fnr%2F2697907%2F%3FpaymentId%3D581855

    1. Update DIRECT PAY REDIRECT URLS (pay-api secret):

    @doug-lovett which urls do you want here?

    https://dev.assets.bcregistry.gov.bc.ca/*
    https://test.assets.bcregistry.gov.bc.ca/*
    https://assets.bcregistry.gov.bc.ca/*

    1. Payment failed screenshot:

    @LizGovier new CC payment screen

    Image

    payment failed screen:

    Image

  7. doug-lovett commented on Apr 29, 2025

    @doug-lovett
    Collaborator

    @seeker25 thanks I was looking for the payment portal URL.

  8. LizGovier commented on May 1, 2025

    @LizGovier
    Author

    @seeker25
    Thanks Travis! :)

  9. doug-lovett commented on May 1, 2025

    @doug-lovett
    Collaborator

    Example manufacturer new home request url with cc payment override:
    POST /mhr/api/v1/registrations?ccPayment=true

    Example response:

    {
      "accountId": "3250",
      "affirmByName": "BCREGTEST LUCILLE SIXTYONE",
      "attentionReference": "John Irving",
      "clientReferenceId": "UT-MHREG-MAN-001",
      "description": {
        "baseInformation": {
          "make": "WATSON IND. (ALTA)",
          "model": "DUCHESS",
          "year": 2024
        },
        "csaNumber": "786357",
        "csaStandard": "Z240",
        "manufacturer": "HOME STYLE SOLUTIONS LTD. / ALAN SERVICES LIMITED",
        "sectionCount": 1,
        "sections": [
          {
            "lengthFeet": 60,
            "serialNumber": "23737",
            "widthFeet": 14
          }
        ]
      },
      "location": {
        "address": {
          "city": "VANCOUVER",
          "country": "CA",
          "postalCode": "V6A 2T7",
          "region": "BC",
          "street": "234-475 MAIN ST"
        },
        "dealerName": "HOME STYLE SOLUTIONS LTD. / ALAN SERVICES LIMITED",
        "locationType": "MANUFACTURER"
      },
      "ownLand": true,
      "ownerGroups": [
        {
          "groupId": 1,
          "owners": [
            {
              "address": {
                "city": "RICHMOND",
                "country": "CA",
                "postalCode": "V7E 6T7",
                "region": "BC",
                "street": "4233 BAYVIEW ST"
              },
              "groupId": 1,
              "organizationName": "HOME STYLE SOLUTIONS LTD.",
              "ownerId": 1,
              "partyType": "OWNER_BUS",
              "phoneNumber": "(237) 942-8349"
            }
          ],
          "type": "SOLE"
        }
      ],
      "payment": {
        "ccPayment": true,
        "invoiceId": "49436",
        "paymentActionRequired": true,
        "paymentPortalURL": "{PAYMENT_PORTAL_URL}/{invoice_id}/{return_URL}",
        "receipt": "/api/v1/payment-requests/49436/receipts"
      },
      "paymentPending": true,
      "registrationType": "MHREG",
      "submittingParty": {
        "address": {
          "city": "Vancouver",
          "country": "CA",
          "postalCode": "V6A 2T7",
          "region": "BC",
          "street": "234-475 Main St"
        },
        "businessName": "QS Manufacturer Account",
        "emailAddress": "divya.chandupatla@gov.bc.ca",
        "phoneExtension": "1",
        "phoneNumber": "2763582735"
      },
      "usergroup": "mhr_manufacturer",
      "username": "bcsc/bevq2iyeexmgvvtqnqtj4spm2agv3fo5"
    }
    

    New response properties that specify cc pending payment:

      "payment": {
        "ccPayment": true,
        "invoiceId": "49436",
        "paymentActionRequired": true,
        "paymentPortalURL": "{PAYMENT_PORTAL_URL}/{invoice_id}/{return_URL}",
        "receipt": "/api/v1/payment-requests/49436/receipts"
      },
      "paymentPending": true,
    
  10. doug-lovett commented on May 1, 2025

    @doug-lovett
    Collaborator

    Example drafts list entry with cc payment pending:

    [
      {
        "clientReferenceId": "UT-MHREG-MAN-001",
        "createDateTime": "2025-05-01T15:28:23+00:00",
        "draftNumber": "P001698",
        "lastUpdateDateTime": "2025-05-01T15:28:23+00:00",
        "mhrNumber": "",
        "path": "/mhr/api/v1/drafts/P001698",
        "paymentPending": true,
        "registeringName": "",
        "registrationDescription": "MANUFACTURED HOME REGISTRATION",
        "registrationType": "MHREG",
        "submittingParty": "QS Manufacturer Account"
      },
    ...
    ]
    
  11. doug-lovett commented on May 1, 2025

    @doug-lovett
    Collaborator

    Example of account registration list when existing MHR has a cc pending payment registration (locked).

    [
      {
        "clientReferenceId": "UT-MHREG-MAN-001",
        "createDateTime": "2025-05-01T16:24:43+00:00",
        "documentId": "80100094",
        "documentRegistrationNumber": "00551783",
        "hasCaution": false,
        "legacy": false,
        "lienRegistrationType": "",
        "locationType": "MANUFACTURER",
        "mhrNumber": "108427",
        "ownerNames": "HOME STYLE SOLUTIONS LTD.",
        "path": "/mhr/api/v1/registrations/108427",
        "registrationDescription": "MANUFACTURED HOME REGISTRATION",
        "registrationType": "MHREG",
        "statusType": "DRAFT",
        "submittingParty": "QS MANUFACTURER ACCOUNT",
        "username": "BCREGTEST LUCILLE SIXTYONE"
      },
    ...
    ]
    

    And the same registration after payment completes:

    [
      {
        "changes": [
          {
            "clientReferenceId": "UT-PERMIT-QS-001",
            "createDateTime": "2025-05-01T16:34:40+00:00",
            "documentId": "80100095",
            "documentRegistrationNumber": "00551784",
            "expireDays": 31,
            "legacy": false,
            "locationType": "STRATA",
            "mhrNumber": "108427",
            "ownerNames": "HOME STYLE SOLUTIONS LTD.",
            "path": "/mhr/api/v1/documents/80100095",
            "registrationDescription": "TRANSPORT PERMIT",
            "registrationType": "PERMIT",
            "statusType": "ACTIVE",
            "submittingParty": "QS MANUFACTURER ACCOUNT",
            "username": "BCREGTEST LUCILLE SIXTYONE"
          }
        ],
        "clientReferenceId": "UT-MHREG-MAN-001",
        "createDateTime": "2025-05-01T16:24:43+00:00",
        "documentId": "80100094",
        "documentRegistrationNumber": "00551783",
        "hasCaution": false,
        "legacy": false,
        "lienRegistrationType": "",
        "locationType": "STRATA",
        "mhrNumber": "108427",
        "ownerNames": "HOME STYLE SOLUTIONS LTD.",
        "path": "/mhr/api/v1/registrations/108427",
        "registrationDescription": "MANUFACTURED HOME REGISTRATION",
        "registrationType": "MHREG",
        "statusType": "ACTIVE",
        "submittingParty": "QS MANUFACTURER ACCOUNT",
        "username": "BCREGTEST LUCILLE SIXTYONE"
      },
    ...
    ]
    
  12. 10 remaining items

  13. chdivyareddy commented on May 13, 2025

    @chdivyareddy
    Collaborator

    @doug-lovett thanks for checking, can you please let me know who is the best person to reach out to for setting it up? thanks!

  14. seeker25 commented on May 13, 2025

    @seeker25
    Contributor

    Goto the account in auth-web, change the payment method? Unless it's not possible, if it's not, give me a message

  15. chdivyareddy commented on May 13, 2025

    @chdivyareddy
    Collaborator

    Verified in TEST!

    image.png

  16. changed the issue type fromtoon Jun 3, 2025
  17. changed the issue type fromtoon Jun 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

AssetsPayapi

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions